Gossamer Forum
Home : General : Perl Programming :

regexp question(s)

Quote Reply
regexp question(s)
in db.pl of links v2 there is ...

/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/

I'm playing with a character based language (not english) and I think the font is screwing me ....

if I knock out (\[?) I can continue with admin.cgi If I leave this first section in I get an "unmatched () in regexp" error Frown

Now, if I erase all occurences of this in db.pl will I be screwing myself?

hehe .... I'm really having lots of fun digging around in links v2 -- there's so much to learn!!!
Crazy just going a bit crazy though!

any comment or help would be appreciated!

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
ahhh ... took a break now back to work.

ummm ... log my on research. the problem probably wasn't the regexp but still would like to learn more about this puppy of a function.

But first I got figure out those darn print qq| and |; variations while working with foreign languages. eh!

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
I've never understood that regex above. It appears like it would accept [ and ] in email addresses.

Also it rejects .info so {2,3} needs to be changed to {2,4}

Last edited by:

RedRum: Nov 10, 2001, 6:09 AM
Quote Reply
Re: [RedRum] regexp question(s) In reply to
Crazy

this is really driving me crazy. I got links v2 going somewhat but no my database is getting friend the pipes "|" are changing in to multiple "~" tildes .... errrr .....

I wonder if these lines like split (/\//, $input) are the problem?

Code:
split (/\//, $input)
but the back slach is throwing an error... I tried using the yen mark ... well that's what it looks like the font I'm using ... hmmm is there way tog et around the back slasH?

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
Crazy

ok ...still pluggin along ...

new question ...

Code:
@dirs = split ("/\//", $input);

can I add double-quotes like I did and come away with no problems? command line check says snytax is finally OK but ... I have no clue if what I did is OK or not Crazy

would appreciate any comments.

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
some things just don't need to be quoted. Variables, regexps, and numbers should not quoted, or else they'll be interpreted as strings.

You should be able to change that code to:

Code:
@dirs = split /\//, $input;

You don't always have to use ( ) either...

Code:
sub funky { return join "\n", grep { !/^\s*$/ } split /\n/, shift }

I used to think that was cool. Sly

--Philip
Links 2.0 moderator
Quote Reply
Re: [PerlFreak] regexp question(s) In reply to
...and now it's just plain showing off :)

@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print

Some code to crash your browser anyone?

Last edited by:

RedRum: Nov 12, 2001, 3:16 PM
Quote Reply
Re: [PerlFreak] regexp question(s) In reply to
thanks.

I noticed in nph-build that () are used and not used depending on the sub.

DAM I wish I could've taken PERL classes way back in the stoneage ....

Oh well, I get to learn PERL the hard way ... dig through a great script and try to figure out what all the archaic code is supposed to do .... I really need to get the CAMEL Blush

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
hi again ... (welcome back to my study thread)

OK ... could somebody explain this line ...

Code:
if ($dir !~ m,^[\w\d$chrs]+$,) {

nph-build is dieing on me right now at this line in sub build_check_dir. What's confusing me is that $root and $dir added together are "/Users/qooq/Sites/scripts/resources/Detailed"

nothing strange in that ... or am I just strange???

hmmm I wonder if the script is actually giving me troubles before that like in sub build_detailed_view ...

CrazyCrazy

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
Hehe coincidence....I just had to edit that code today for my pal Ed

Hmm I think that code is longer that it has to be.... \w allows a-z,0-9 and \d is 0-9 ...hmmm

Anyway if you want to take a risk just delete that if {} block altogether
Quote Reply
Re: [RedRum] regexp question(s) In reply to
who the hell is this ED anyway .. ??? I keep seeing his name in your posts!

ummm ... I don't think it's that area ... right now I think I have a problem with my related categories.

in my categories.db I got ie ..
Code:
DBMan~~FileMan

hmmm .... is this normal? also, where in the script is this being built. for the last half hour I've been reading and digging but nothing really specific is coming up Crazy

I've at least turned to my cgi programming in a week (huck huck huck --yeah right!) book since it has an appenix that covers the regexp a little ... which is why I started digging even deeper (or looking in the more obvious spots) for my trouble area.

thanks for dropping in Smile

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] regexp question(s) In reply to
Ed is my invisible friend :)

I just heard a bird being killed by a cat outside my window and Im feeling sad :( .....the noise made my skin crawl. It's 3.09am too :(

>>hmmm .... is this normal?<<

Yep.

Multiple values for one field are seperated by ~~


Quote Reply
Re: [RedRum] regexp question(s) In reply to
Frown I love my cats but whenever they bring something home it's always a mixed feeling type of thing. I cringe and say "good boy/girl" knowing that they bring home gifts is their custom but I always feel sad for their prey ... errr ... not snakes though ... creepy buggers.

thanks for always stopping by!
----------------------------------------------------

OK --- dug around and dug around and finally just deleted the line
Code:
&build_check_dir ($build_root_path, $path);

from sub build_dir (nph-build.cgi -- links v2) and guess what it works. hehe Paul you're right the previous post you mentioned just deleting that block ... errr for me this isn't a problem but ... I'm worried that if later I or my friend who's helping with my site might by accident use a bad character.

hmmm I wonder how you would go about expanding the charset to other languages in the line
Code:
if ($dir !~ m,^[\w\d$chrs]+$,) {
in sub build_check_dir (nph-build.cgi links v2) Crazy

openoffice + gimp + sketch ... Smile