Hi,

> var sYear:String = "1234567";
> var pattern:RegExp = /(\d\d\d)(?=(?:\d\d\d)*[^\d])/g;
> sYear = sYear.replace(pattern, ",$1");
> //traces 1234567

That's because [^\d] expects a non-digit after the number.... 

Try this:
var sYear:String = "The year when all happened was 1234567 indeed" // :)

To get this to also work with just the year you may replace [^\d] with
(?:[^\d]|$) which expects a non-digit or the end of the string


regards

Claudius

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

Reply via email to