I have a problem with a regular expression, and it is that I need to select only the commas of a text, excluding the commas that are inside the single quotes.
The text in question is as follows:
9772,'Oficinas, Servi y cajeros',9664,7,0
The most I have achieved is with this regular expression [A-Za-z1-9'],[A-Za-z1-9']
which does not work for me since when doing the .split() in java, I also cut the other digits and characters
I don't even know if what I explain can be done, so any kind of help would be appreciated.
I would start by separating the text into three sections:
In the regular expression you can see two capturing groups that would be:
Entry:
5658586,9772,'Oficinas, Servi y cajeros',9664,7,0
5658586,9772,
,9664,7,0
And from the concatenation of the capture groups skipping the first character of the second group, you could already process the information through the split function.
I have already found a valid solution for my problem, this regular expression should work
,(?=(?:[^']|'[^']*')*$)