Hi,

> is there a way of counting back from the end of the number and  
> inserting the comma (even without a regular expression)? if i 
> use the  
> g modifier in the regexp (so var pattern:RegExp = /000/g;), it will  
> only pick up the first 000 (and every multiple thereafter) 
> instead of  
> leaving the first 0 (which is expected behaviour but something i'd  
> like to get around)

How about positive lookaheads?

/(000)(?=(?:000)*[^0])/g

If you want this also to work for "1234567" => "1,234,567", you can replace
every 0 in the pattern with \d and call the replace function with ",\1"
instead of ",000"

This is untested, but should work... Let me know.

regards,

Claudius

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

Reply via email to