.net - Regex to get content in the last occurrence of brackets in the most outer level -
i have string: example(123) (example (123))
i'm trying string in bold. have regex: (?<=().+?(?=))
the regex works of time text in brackets, not when there's more 1 occurrences nested brackets.
please advise how can fix this.
thanks!
you need recursive regex proper matching. 1 work:
\(\w+\s*(?r)*[^()]*\)
issues:
- with 1 pattern matching outer parentheses.
- it not anchored end of string. don't know how can achieve it. need grab last match.
Comments
Post a Comment