[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Regular Expression for matching multiple discreet instances within a larger pattern

Asked by ewolsing in Regular Expressions

Tags: RegExp

I am try to develop a regular expression to match multiple instances that look like the following:

Instance 1:   {--command--}
Instance 2:   {--command value="argument"--}
Instance 3:   {--command value="argument1" value="argument2" ... value="argumentN"--}

I wish to capture the command, and any arguments associated with it.  Multiple instance of any of the above patterns may be found within the text I'm searching.

So far, I have put together the following pattern:

\{--([a-zA-Z0-9_-]*?)( [Vv][Aa][Ll][Uu][Ee]="(.*?)")*--\}

It handles the the first and second instances without any apparent trouble; however, it refuses to match multiple value="argument" pairs and will only match the last pair in the list.

For all of you Regex gurus out there -- any ideas?
[+][-]10/27/09 11:48 AM, ID: 25675974Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/27/09 11:51 AM, ID: 25675998Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625