Re: [Flashcoders] RegExp headache
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 Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community Anyone can follow my nonsense on Twitter: jmerrill_2001. If you know me personally, follow more nonsense on Facebook. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RegExp headache
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 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 is killing me. var pattern:RegExp = /^(\d)?(^\d+)|(?)/ var result:Object = pattern.exec(tConditionalString); I tried another approach but i am still figuring out how to do it. It goes something like this var pattern:RegExp = /^():((?(2)then|else)) Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RegExp headache
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 result[4]. You said integer, so I threw in the optional negative sign. :) Dave On Thu, Mar 5, 2009 at 10:02 AM, Glen Pike g...@engineeredarts.co.ukwrote: 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 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 is killing me. var pattern:RegExp = /^(\d)?(^\d+)|(?)/ var result:Object = pattern.exec(tConditionalString); I tried another approach but i am still figuring out how to do it. It goes something like this var pattern:RegExp = /^():((?(2)then|else)) Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RegExp headache
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 Expressions on a whim - I have hacked a few from some examples for projects, but it's nothing I really understand too much, a skill I need to learn - they are so handy. Jason Merrill Bank of America | Learning Performance Solutions Instructional Technology Media Learn about the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community Anyone can follow my nonsense on Twitter: jmerrill_2001. If you know me personally, follow more nonsense on Facebook. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RegExp headache
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... http://www.addedbytes.com/apache/mod_rewrite-cheat-sheet/ http://www.addedbytes.com/apache/url-rewriting-for-beginners/ That's what I did, now one day I will be able to do the mental gymnastics of the other people, but for now, I will just have to keep looking up the RegEx bits - RegExr is good for this - because I have too many other things to learn along with RegEx's... If you want to hurt your brain whilst learning them inside out try this: http://www.regular-expressions.info/ Glen Merrill, Jason wrote: /(((|)=?)|==)?(-?\d+)/ hot darn. A side note. I'm so in awe at the people who understand and can write Regular Expressions on a whim - I have hacked a few from some examples for projects, but it's nothing I really understand too much, a skill I need to learn - they are so handy. Jason Merrill Bank of America | Learning Performance Solutions Instructional Technology Media Learn about the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community Anyone can follow my nonsense on Twitter: jmerrill_2001. If you know me personally, follow more nonsense on Facebook. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] RegExp headache
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 the Bank of America Flash Platform Community Anyone can follow my nonsense on Twitter: jmerrill_2001. If you know me personally, follow more nonsense on Facebook. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders