wow - that's really helpful - thanks a lot for your time claudius

best
a


On 4 Jul 2008, at 14:56, Claudius Ceteras wrote:




the \b boundary worked a treat - i'm just researching why it
worked now


/(\d\d\d)(?=(?:\d\d\d)*\b)/g

Find all groups of three digits < (\d\d\d) >, which are followed by <
positive lookahead: (?= ) >
0, 3, 6, 9, ... Digits, followed by a word boundary < (?:\d\d\d)*\b >

Word boundaries match at the end of the number, so because it only matches
three digits groups which are followed by a number of digits which is
divisible by 3, it doesnt find "123" in "1234567", but "234" (because it's followed by 3 digits followed by a word boundary) and "456" (because it's
followed by 0 digits followed by a wod boundary)

Btw,
(?:   ) is a non-capturing group,
(?=   ) is a positive lookahead.
You can google for both...


regards

Claudius

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to