I want to write Regex expression using C#
to find the first )
character that isn't wrapped around single or double-quotes.
I have the following string ("some () test 1", 'some text)', 1235,"",null ) testing something
The only )
that I want to find is the one after the null.
I am unsure how to express "not between" using regex. Here is what I tried
[^(("|').*\).*("|'))]\)
But that is matching more that I am expecting.
How can I correctly find the close parentheses that aren't wrapped around the quotes?
Using C# Regex.Match(str, pattern)
should return the first occurrence if my expression was valid.
Updated Here are some texts that I want to be able to evaluate
- ("some () test 1", 'some text)', 1235,"",null ) testing something
- ("some test 1", 'some text', null, "")
- ()
- (1)
- (1,2)
- ("text")
- ('text ) ')
- ("te)t")
- ("te )st") blah blah