I have been trying to figure out a regex for matching complete strings in SQL, from a .sql file (including escaped single quotes), and the ones I've come up with either don't capture enough of the string or result in a StackOverflow exception (I suspect from the possible combinations of ''|[^'].
The regex I was trying to build was something along the lines of
(?<!')'(''|[^'])*'(?!')
I want there to be a ' starting and ending the string, with any number of pairs of ' and non single '`' characters between.
One solution I considered is to first replace pairs of ' with a different character and then simply look for anything between single ', but is there way to configure my regex to do this (and actually run).
-'This is a string. It''s single quoted!!!'''-, and it returned the correct substring nigh-instantly.''|[^'], as that is what I'm suspecting is causing it.