Re: [Flashcoders] RegExp question

2009-11-05 Thread Ian Thomas
Hi Michael, Firstly, I'm not quite sure your expression is right - it says g _or_ 1 or 2 or 3 as the first character, whereas your sample starts with a g then a 1. But anyway - what you need to do is to test for the beginning and end of the string. In regular expressions, you do this with the

Re: [Flashcoders] RegExp question

2009-11-05 Thread Henrik Andersson
Mendelsohn, Michael wrote: I want the *entire* text in the text box to be considered, not just a matched substring. Is this possible? Use ^ to lock to the begining of the string and $ to lock to the end of the string, use both and it will not be allowed anything other than the expression.

RE: [Flashcoders] RegExp question

2009-11-05 Thread Mendelsohn, Michael
Thanks very much Ian and Henrik. The ^ and $ was exactly what I was looking for. Regards, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] regexp question

2008-07-04 Thread Allandt Bik-Elliott (Receptacle)
wow - i have no idea what that means at all time to hit the books - thanks :) 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

Re: [Flashcoders] regexp question

2008-07-04 Thread Allandt Bik-Elliott (Receptacle)
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 =

Re: [Flashcoders] regexp question

2008-07-04 Thread Sidney de Koning
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

Re: [Flashcoders] regexp question

2008-07-04 Thread Allandt Bik-Elliott (Receptacle)
hey that's great sid - thanks a On 4 Jul 2008, at 12:26, Sidney de Koning wrote: 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

RE: [Flashcoders] regexp question

2008-07-04 Thread Claudius Ceteras
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

RE: [Flashcoders] regexp question

2008-07-04 Thread Claudius Ceteras
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 Or even better Replace [^\d] with \b which should also work. regards Claudius ___ Flashcoders mailing list

Re: [Flashcoders] regexp question

2008-07-04 Thread Allandt Bik-Elliott (Receptacle)
the \b boundary worked a treat - i'm just researching why it worked now thanks for all your help guys a On 4 Jul 2008, at 13:17, Claudius Ceteras wrote: 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

RE: [Flashcoders] regexp question

2008-07-04 Thread Claudius Ceteras
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

Re: [Flashcoders] regexp question

2008-07-04 Thread Allandt Bik-Elliott (Receptacle)
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

RE: [Flashcoders] regexp question

2008-07-03 Thread Claudius Ceteras
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

Re: [Flashcoders] regexp question

2008-07-02 Thread Juan Pablo Califano
Hi, You can check out ascb (ActionScript Cook Book), a library with some useful functions. In this case, the class NumberFormat, and the method format may do the job. http://www.rightactionscript.com/ascb/ Almost any formatNumber method you can find in many other libraries will help you too,

Re: [Flashcoders] regexp question

2008-07-02 Thread Allandt Bik-Elliott (Receptacle)
thanks a lot :) On 2 Jul 2008, at 15:24, Juan Pablo Califano wrote: Hi, You can check out ascb (ActionScript Cook Book), a library with some useful functions. In this case, the class NumberFormat, and the method format may do the job. http://www.rightactionscript.com/ascb/ Almost any