Need Help With Simple Regex
Posted
by npinti
on Stack Overflow
See other posts from Stack Overflow
or by npinti
Published on 2010-05-03T17:06:17Z
Indexed on
2010/05/03
17:18 UTC
Read the original article
Hit count: 246
I have strings of this type:
text (more text)
What I would like to do is to have a regular expression that extracts the "more text" segment of the string, so far I have been using this regular expression:
"^.*\\((.*)\\)$"
Which although it works on many cases, it seems to fail if I have something of the sort:
text (more text (even more text))
What I get is: even more text)
What I would like to get instead is: more text (even more text) (basically the content of the outermost pair of brackets.)
Thanks
© Stack Overflow or respective owner