Re: [Flashcoders] RegExp Help

2011-03-13 Thread Karim Beyrouti
This is great - thanks for explaining, helps a lot. the original expression I posted works this tool : http://gskinner.com/RegExr I would love to know what magic Grant is using to get it working in his RegExp utility. Thank you Anthony. On 11 Mar 2011, at 23:42, Anthony Pace wrote: Hi

Re: [Flashcoders] RegExp Help

2011-03-13 Thread Karim Beyrouti
I seem to be having some mixed results with this one: var tStr: String = '-path:c:\test path\temp -param spaced string -x' var patt: RegExp = new RegExp( '(?=[-{1,2}|/])(?Pname[a-zA-Z0-9]*)(?::|=)*(?Pvalue[\w|.|?|=||+| |:|/|\\]*)(?=[ |]|$)' , 'g'); var result : Object =

[Flashcoders] RegExp Help

2011-03-11 Thread Karim Beyrouti
Hello lovely list...I am trying to run a RegExp pattern on a String, and am not too sure why it's not working, and am not too sure why. Here is the code: var tStr: String= '/a:value -big=this -test:123 -test2=th_3' var r : RegExp= new RegExp(

Re: [Flashcoders] RegExp Help

2011-03-11 Thread Ktu
I just plugged it into RegExr http://www.regexr.com and I can't make sense of it. Try using that tool to build it. It really helps On Fri, Mar 11, 2011 at 5:56 AM, Karim Beyrouti ka...@kurst.co.uk wrote: Hello lovely list...I am trying to run a RegExp pattern on a String, and am not too sure

Re: [Flashcoders] RegExp Help

2011-03-11 Thread Anthony Pace
Hi Karim and Ktu, Below is an explanation of what appears to be going on in the given pattern: (?:\s*) is a greedy non-capturing group of whitespace (?=[-|/]) is looking behind the next section of the expression, (?name\w*), for, what is in this case, a character set; as well, it does so

Re: [Flashcoders] regExp

2010-06-19 Thread Karl DeSaulniers
Looks like it worked. Tried a dozen OCR sites and none could match any letters. There may be a super OCR bot somewhere, but not really worried. Anyone know of somewhere I can test further, similar to what the bots use? I figure this question may have a taboo answer, just want to be sure.

Re: [Flashcoders] regExp

2010-06-18 Thread Steven Sacks
I guess you were using AS2? There is no native RegEx in AS2, though, so I don't see how you were going to use AS3 in AS2. In AS3, you should NEVER use anything other than ints to iterate integer values. Don't use uint, and don't use Number. That code I provided is code I wrote and tested in

Re: [Flashcoders] regExp

2010-06-18 Thread Steven Sacks
And just to add to this, in AS3, I never use Array anymore for the very reason that passing an out of range value returns undefined instead of throwing an out of range error. So, I always use Vector. ___ Flashcoders mailing list

Re: [Flashcoders] regExp

2010-06-18 Thread Karl DeSaulniers
Ah, yes, I thought I has stated that. I am using AS2. I tried setting the Math.random first and then I used Math.floor, that seemed to work, but I put an extra catch and set up a.. if(ranCode == undefined){ ranCode = 0; } and so a zero gets added instead of any undefined and that

Re: [Flashcoders] regExp

2010-06-17 Thread Steven Sacks
RegEx isn't really used for what you're talking about. You should use ascii codes to create your alphanumeric array and then choose random indexes from it to create your random string. var i:int; var alphaNumeric:Array = []; for (i = 97; i 123; ++i) {

Re: [Flashcoders] regExp

2010-06-17 Thread Karl DeSaulniers
Ah thanks Steve. So is 97 to 123 the placement of upper and lowercase letters and the numbers on the CharCode chart? and are the upper and lowercase letters 32 letters apart on the chart? Trying to understand where you got these values. Your solution is very good and interesting to me. Also,

Re: [Flashcoders] regExp

2010-06-17 Thread Steven Sacks
http://www.asciitable.com/ a-z = 97-122 A-Z = 65-90 97 - 65 = 32 a-z = 26 letters A-Z = 26 letters 0-9 = 10 numbers 26 + 26 + 10 = 62 On 6/16/2010 11:15 PM, Karl DeSaulniers wrote: Ah thanks Steve. So is 97 to 123 the placement of upper and lowercase letters and the numbers on the CharCode

Re: [Flashcoders] regExp

2010-06-17 Thread Karl DeSaulniers
Nice! Thank you. On Jun 17, 2010, at 2:49 AM, Steven Sacks wrote: http://www.asciitable.com/ a-z = 97-122 A-Z = 65-90 97 - 65 = 32 a-z = 26 letters A-Z = 26 letters 0-9 = 10 numbers 26 + 26 + 10 = 62 On 6/16/2010 11:15 PM, Karl DeSaulniers wrote: Ah thanks Steve. So is 97 to 123 the

Re: [Flashcoders] regExp

2010-06-17 Thread Jim Lafser
: [Flashcoders] regExp Nice! Thank you. On Jun 17, 2010, at 2:49 AM, Steven Sacks wrote: http://www.asciitable.com/ a-z = 97-122 A-Z = 65-90 97 - 65 = 32 a-z = 26 letters A-Z = 26 letters 0-9 = 10 numbers 26 + 26 + 10 = 62 On 6/16/2010 11:15 PM, Karl DeSaulniers wrote: Ah thanks

Re: [Flashcoders] regExp

2010-06-17 Thread Juan Pablo Califano
If don't want to learn the ascii codes by heart (or look them up), you can use charCodeAt() like this: var first:int = (A).charCodeAt(0); var last:int = (Z).charCodeAt(0); for (var i:int = first; i = last; i++) { trace(String.fromCharCode(i)); } Cheers Juan Pablo Califano 2010/6/17 Karl

Re: [Flashcoders] regExp

2010-06-17 Thread Karl DeSaulniers
Thanks Juan, Thanks Jim. @Steve I noticed with your example I get undefined as one of the results. Also, I had to change the var i:int; to var i:number = 0; I got an error with int saying it could not load the class or interface for int. What am I missing here? TIA Karl On Jun 17, 2010, at

[Flashcoders] regExp

2010-06-16 Thread Karl DeSaulniers
Hi I have an array that I think could use some shortening. It is an array of the alphabet and numbers that I use to get a random letter/number combo from. I am sure there is a better way to do this. Maybe a regExp? In essence, I want to get a random combo of Upper and lowercase letters and

RE: [Flashcoders] RegExp

2010-03-12 Thread Cor
Very nice! Thanks Karl! Regards Cor van Dooren -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl DeSaulniers Sent: vrijdag 12 maart 2010 8:36 To: Flash List Subject: [Flashcoders] RegExp Hello List

Re: [Flashcoders] RegExp

2010-03-12 Thread Karl DeSaulniers
...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl DeSaulniers Sent: vrijdag 12 maart 2010 8:36 To: Flash List Subject: [Flashcoders] RegExp Hello List, A while back I remember someone asking about RegExp (regular expressions). I found this website. Now it is not flash based

RE: [Flashcoders] RegExp

2010-03-12 Thread Mendelsohn, Michael
Here's a great RegEx resource: http://gskinner.com/RegExr/ - MM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

[Flashcoders] RegExp

2010-03-11 Thread Karl DeSaulniers
Hello List, A while back I remember someone asking about RegExp (regular expressions). I found this website. Now it is not flash based, it is javascript, but interesting none the less. May give people hints on how to construct their own in AS or even PHP for that matter. I am new to lists

[Flashcoders] RegExp question

2009-11-05 Thread Mendelsohn, Michael
Hi list... I have some input text box with a go button that is enabled or disabled based on an Event.CHANGE for the TextInput. As someone types in a string, a go button becomes enabled or disabled, but I want the *entire* text in the text box to be considered, not just a matched substring.

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

[Flashcoders] RegExp vs. CDATA in E4X

2009-09-15 Thread Mendelsohn, Michael
Hi list... I'm debating using a RegExp to search for a value in E4X, or do it by searching the below data within CDATA. I think the RegEx would be cooler to use, making for a smaller XML file, but I wonder if it would be faster to simply loop through an array of these values. Anyone have any

Re: [Flashcoders] RegExp vs. CDATA in E4X

2009-09-15 Thread Steven Sacks
You, sir, are a victim of premature optimization. Write it the easy way. If it proves to be a bottleneck later, optimize it then. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

RE: [Flashcoders] RegExp vs. CDATA in E4X

2009-09-15 Thread Mendelsohn, Michael
Will do, sage advice. - MM Write it the easy way. If it proves to be a bottleneck later, optimize it then. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] RegExp headache

2009-03-06 Thread Jiri
Everybody thank you! Jiri Merrill, Jason wrote: Seriously, just play with RegExr / Regex Buddy, get the cheat sheets: Am now - love it! Can't I still be in awe? :) Jason Merrill Bank of America | Learning Performance Solutions Instructional Technology Media Learn about the

[Flashcoders] RegExp headache

2009-03-05 Thread Jiri
I would like some help on a regExp I have a string and want to split it into the first character being a ||=|=|== the second part being an int. so 100 would return result[1] = '' result[2] = 100 so 100 would return result[1] = 'undefined' result[2] = 100 Here is what I have so far, but it

Re: [Flashcoders] RegExp headache

2009-03-05 Thread Glen Pike
Hi, How about: /([=]+)([0-9]+)/ Check out RegExr by Grant Skinner - it's lovely. The problem with = and = is that there is look behind in the regex controlled by these chars so the order of = seems to be important??? Glen Jiri wrote: I would like some help on a regExp I

Re: [Flashcoders] RegExp headache

2009-03-05 Thread David Hershberger
oops, forgot about the comparison operator being optional. New version: /(((|)=?)|==)?(-?\d+)/ hot darn. Dave On Thu, Mar 5, 2009 at 10:44 AM, David Hershberger he...@zipzapplay.comwrote: How's this? /(((|)=?)|==)(-?\d+)/ Then the comparison operator is in result[1] and the number is in

Re: [Flashcoders] RegExp headache

2009-03-05 Thread Ian Thomas
Like Glen said, check out Grant's RegExr - it really helps this kind of thing out. :-) Ian On Thu, Mar 5, 2009 at 6:51 PM, Merrill, Jason jason.merr...@bankofamerica.com wrote: /(((|)=?)|==)?(-?\d+)/ hot darn. A side note.  I'm so in awe at the people who understand and can write Regular

Re: [Flashcoders] RegExp headache

2009-03-05 Thread Glen Pike
Seriously, just play with RegExr / Regex Buddy, get the cheat sheets: http://www.regexbuddy.com/ http://gskinner.com/RegExr/ http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/ Then spend some time dealing with Apache Mod Rewrite which will stretch your regex muscles...

RE: [Flashcoders] RegExp headache

2009-03-05 Thread Merrill, Jason
Seriously, just play with RegExr / Regex Buddy, get the cheat sheets: Am now - love it! Can't I still be in awe? :) Jason Merrill Bank of America | Learning Performance Solutions Instructional Technology Media Learn about the Adobe Flash platform for rich media experiences - join

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

[Flashcoders] regexp question

2008-07-02 Thread Allandt Bik-Elliott (Receptacle)
hey i am using regexp to inject commas into my years by searching for 000 and replacing with ,000 like this var pattern:RegExp = /000/; sYear = sYear.replace(pattern, ,000); however, this approach will bug every multiple of 10,000 as there are more zeros than the pattern expects. is

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