Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular Expression patern to ignore between parentheses

Status
Not open for further replies.

x6213

Programmer
Aug 17, 2005
17
US
I need help making a regex patern to split strings with
the delimiter as a backslash; and I need it to ignore any backslashes inside parentheses "(" & ")"

example
string = "red \ (blue) \ (green\blue)\ black"

split should be
0=red
1=(blue)
2=(green\blue)
3=black

also there is no uniformity to the spaces abound the slashes


thanks,
-x6213
 
Roughly this pattern.
[tt] .pattern="[^\(\\\s][^\\]*|\([^\)]*\)"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top