Regex supports lazy matching as well using the '?' option on pretty much any quantifier.
Scott On 24/08/06, neo binedell <[EMAIL PROTECTED]> wrote:
RegEx performs greedy searches, so it would find a first and move past it, which would break the second pattern as it would just be "b". In general you want to order your expressions from longer matching to shorter if one contains the other. Just think of it as gobbling up patterns before other patterns get a look at it. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Miguel Serrano Sent: 23 August 2006 06:25 PM To: [email protected] Subject: [Flashcoders] Regular Expressions Hi list! I don't understand one issue of RegExp framework: the illustrative example: var pattern:RegExp = /(a)|(ab)/ pattern.exec("nnnabnnn"); trace (result[0]) // output a pattern = /(ab)|(a)/ pattern.exec("nnnabnnn"); trace (result[0]) // output ab Why this behaviour? shouldn't RegExp return the longest pattern founded in the string?. Calling exec several times with first expression never return "ab" It's supossed that conditional operator "|" is conmutative. Any idea? thank you! _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

