Jump to content

Recommended Posts

Hello altogether,

yes I already noticed the  StringRegExp AutoIt reference  and the very good german tutorial of SEuBo, but nevertheless I would be pleased to get a tip.

I have strings like this:

'repair car "do it your self" check' 

or

' repair car toyota'.

There could be none, one or more words in quotation marks. It could be also that no expression is set in quotation marks (-->" "). The words of the string vary. I would like to generate an array like [repair, car, do it your self, check] or [repair, car, toyota]. Expressions in quotation marks (" ") should not be splitted.

Probably I could use string split and similar methods to combine the words in quotation marks afterwards. But that's not the way I'd like to do it.

I already got this reg-exp to extract just the complete expressions in quotation marks (" ") to seperate these from the rest of the terms:

Local $aExtract4 = StringRegExp($sTest4, '.*?"(.*?)".*?',3)

Moreover I found this reg-exp to work similar to StringSplit with a " " as a delimiter. This would probably a solution if I didn't like to keep the terms in quotations marks together.... :

Local $aExtract8 = StringRegExp($sTest4, '(.+?(?:\s|\z))',3)

Nevertheless I failed to find a single reg-exp that is able to met both conditions. I am convincend that it is possible to design a single reg-exp that met both conditions! I already tried different scenarios with operators like or |, the conditional (?(?=   ) clause and the use of assertion (Lookahead / -behind) but without success.

I would appreciate a hint from an "reg-exp expert" if it's able to solve my problem with a single reg-exp and / or to give me some hints how to do that.

Many thanks in advance.

Auto42

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...