Is there any way to detect only the double quotes that are not surrounded by semi-column or if it is at the end of the line ? Example:
test1;"col11 " col12";"col3"
test1;"col11" col12";"col3"
test1;"col11 "col12";"col3"
test1;"col11"col12";"col3"
Output :
test1;"col11 col12";"col3"
test1;"col11 col12";"col3"
test1;"col11 col12";"col3"
test1;"col11col12";"col3"
I used this regex : \b(?!;"|";|"$|"\n)" but the \b excludes the double quote preceded by a space.
You can use
(?<=[^;\r\n])"(?=[^;\r\n])
See the regex demo.
Details
(?<=[^;\r\n])
- immediately on the left, there should be a char other than ;
, CR and LF"
- a double quote(?=[^;\r\n])
- immediately on the right, there should be a char other than ;
, CR and LF.本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句