I want to find a regex that works in JavaScript and have the logic to find all strings that are not inside balanced parentheses, i.e. all strings that start and finish with the char " but are not surrounded by both char ( and char ).
I want that for the text:
1. ("ggg" "H"
2. "ggg") "H"
3. ("ggg") "H"
4. "gg()g" "H"
5. "gg)g" "H"
6. "gg(g" "H"
- the matches: "ggg", "H"
- the matches: "ggg", "H"
- the matches: "H"
- the matches: "gg()g", "H"
- the matches: "gg)g", "H"
- the matches: "gg(g", "H"
this is what I have for now:
but it doesn't work for strings that have the char ) inside
(?<!\()"[^\)]+?"