bman has asked for the wisdom of the Perl Monks concerning the following question:
I have been already trying many approaches that would catch for me the following things:
-41 -55 -jj 1au 24u 36uI have written the following regexp:
All I'm getting is jj4. I have no idea where this comes from.if ($MType =~ /-[45][15j]/ig || /[123][a46]u/ig || /7[9l][hb]/ig) { print "\"red\""; } else { print "\"#CCFFCC\""; }
This is how I interpret my regexp:
1 regexp: If the first char is '-' and second is 4 or 5 and third is 1 or 5 or j OR 2 regexp: If the first char is 1 or 2 or 3 and second is h or b and third is u <...> and so on.Where is my logic flawed? I need some enlightment, PLEASE!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regexp experts, come to rescue!
by kilinrax (Deacon) on Feb 01, 2001 at 19:47 UTC | |
by jeroenes (Priest) on Feb 01, 2001 at 20:17 UTC | |
Re: Regexp experts, come to rescue!
by arturo (Vicar) on Feb 01, 2001 at 21:16 UTC | |
by bman (Sexton) on Feb 02, 2001 at 01:36 UTC | |
Re: Regexp experts, come to rescue!
by mirod (Canon) on Feb 01, 2001 at 20:08 UTC | |
Re: Regexp experts, come to rescue!
by bman (Sexton) on Feb 01, 2001 at 20:07 UTC | |
Re: Regexp experts, come to rescue!
by dsb (Chaplain) on Feb 01, 2001 at 20:39 UTC |
Back to
Seekers of Perl Wisdom