develooper Front page | perl.beginners | Postings from March 2002

Regex peculiarity

Thread Next
David Gray
March 21, 2002 12:59
Regex peculiarity
Message ID:
I'm matching a list of 4 measurments (i.e. 4pc,4pc,4pc,4pc) that all
have to have some sort of unit specification (i.e. 4pc6,4in,4px,4pt) and
I'm running into a bit of an oddity...

If I use the regular expression:


to match the above sequence, it matches the string '10,10,10,10' or any
sequence of 4 2-digit numbers separated by commas, but not one-digit
numbers... The only thing I can think of is that the \w is matching the
commas somehow, but that doesn't make any sense...

I've been staring at this for too long, and it works the way I want it
to if I use:


instead, but I can't figure out what I'm doing wrong in the other
regex... Anyone have any ideas?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About