I have the string like this:
'Code1','Code2','Co''de' , 'CodeTest2'
From that string I would like to get four strings Code1, Code2, Co”de and CodeTest2.
I have almost working regex which is: ‘([^’]*)’
The problem is that my regex should ignore quotes if there are next to each other like in the fire string. Is there any way to exclude double- single quotes from the regex?
>Solution :
You might write the pattern as
'(.*?)'(?=\s*,|$)
See a regex demo
Of without the lookahead:
'([^']*(?:''+[^']*)*)'