Re: [flexcoders] How to split a String on spaces but including Quoted Phrases?

2010-08-02 Thread Nick Middleweek
Guys, I missed this one... Thank you for your replies... I'll check out the code and see what works. I did end up writing a string parser but I'm now curious to see how RegEx stands up to the task. Cheers, Nick On 29 July 2010 23:30, Oleg Sivokon olegsivo...@gmail.com wrote: Ouch,

RE: [flexcoders] How to split a String on spaces but including Quoted Phrases?

2010-07-29 Thread Keith Reinfeld
Nick, I think this satisfies your conditions. There is a for-loop but it's not iterating over the entire string, which, I'm certain, is what you wanted to avoid. var myString:String = 'flex action script parse string function'; var resultArr:Array = regExpDQ(myString, false);

Re: [flexcoders] How to split a String on spaces but including Quoted Phrases?

2010-07-29 Thread Oleg Sivokon
Sorry to chum in :) var re:RegExp = /((|').*(?=\2)\2)|(\s[^\s]+(?!\s))/g; var text:String = ![CDATA[Lacrimosa dies illa, qua resurget ex favilla iudicandus homo reus. Huic ergo parce, Deus: Pie Iesu Domine, dona eis requiem.]].toString(); var result:Object; while (result = re.exec(text)) {

Re: [flexcoders] How to split a String on spaces but including Quoted Phrases?

2010-07-29 Thread Oleg Sivokon
Ouch, actually, it has a flaw, but I'm not sure you need a fix for that, but it's possible to fix it, if you want. It only checks for the double quotes, when it checks for the non-quoted words, but it checks for both single and double quoted groups of words. If you need both single and double