It is worth noting that any solution to a regular expression will not be executed in the following cases:
a = 4, b = 2, c = "space" here"
Although it is true that you could create a regular expression to handle a case with three quotes, you cannot solve the problem in a general sense. This is a mathematically provable limitation of simple DFAs , of which regular expressions are direct representations. To perform any serious brackets / quotes comparisons, you will need a more powerful pushdown automaton , usually in the form of a text analyzer library (ANTLR, Bison, Parsec).
With that said, it sounds like regular expressions should be sufficient for your needs. Just keep in mind the limitations.
source share