I have this regex: (?:\[|\G(?!^))('[^']+?')\s*,?\s*(?=[^\]]*?\])
which matches only content between quotes inside square brackets (like an array): ['Foo', 'Bar'] => returns 'Foo' 'Bar'
.
The problem is that in this case the single quote is an special character, since it's used by the regex as a delimiter, but it's necessary for me to pass sometimes the single quote inside the value as a escaped character: ['F'oo', 'B'ar']
.
I'm trying to do something like 'F\'oo', by adapting this non-capturing (?:(?=(\\?))\1.)
group to the regex, but it doesn't work, I tried many different ways.
This non-capturing group regex comes from this answer, where the he successfully uses the backslash to escape special characters.
I use C# with .NET Core.
The full text is something like: eq('Property', ['F'oo', 'Ba'r', '123'])
How can this be solved?