Hi Allandt,
Have you found this tool already?
http://www.gskinner.com/blog/archives/2008/03/regexr_free_onl.html
It allows you to test your regex pattern expecially for AS
And you can find a cheatsheat on RegEx on www.ilovejackdaniels.com and
there is ofcourse alot on whttp://www.regular-expressions.info/quickstart.html
and http://www.regular-expressions.info/tutorial.html
Hope this will get you started,
Sid
On Jul 4, 2008, at 11:32 AM, Allandt Bik-Elliott (Receptacle) wrote:
hi again
i've been trying different things and it seems that the [^0] or [^
\d] is stopping it working. (I needed to use $1 rather than \1 to
reference the first group in the String.replace statement)
here is what i've got so far
var sYear:String = "1234567";
var pattern:RegExp = /(\d\d\d)(?=(?:\d\d\d)*[^\d])/g;
sYear = sYear.replace(pattern, ",$1");
//traces 1234567
if i drop the NOT part
var sYear:String = "1234567";
var pattern:RegExp = /(\d\d\d)(?=(?:\d\d\d)*)/g;
sYear = sYear.replace(pattern, ",$1");
//traces ,123,4567
This stuff is really new to me so i really appreciate the help
thanks
a
On 4 Jul 2008, at 01:09, Claudius Ceteras wrote:
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders