C#C
C#2y ago
sashok

Regex - Match a string outside of the parentheses

How do I match any e which's not inside of the parentheses?

I have created a pattern to do it, but it doesn't seem to work properly. It should store (s and remove
)
s, so that an e that is outside of the parentheses is matched e.g. ()()()e, but e inside of the parentheses isn't e.g. (e).
https://regex101.com/r/3m6ZUc/1
(?<=(?:[^()]|(?<a>\()|(?<-a>\)))+(?(a)(?!)))e
Was this page helpful?