10,10,10,10 nope.. \d+ matches the first digit \w+ matches the second digit nothing for \d* then ,
try this: /^(?:\d+[a-z]+\d*,?){4}$/ > -----Original Message----- > From: David Gray [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 21, 2002 3:58 PM > To: [EMAIL PROTECTED] > Subject: Regex peculiarity > > > 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: > > /^(?:\d+\w+\d*,?){4}$/ > > 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: > > /^(?:\d+\w{2}\d*,?)$/ > > instead, but I can't figure out what I'm doing wrong in the other > regex... Anyone have any ideas? > > -dave > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]