string - Regex for code formatting -



string - Regex for code formatting -

i add together line feed after semi-comas in text.

something replace(";",";\n\r")

but need exclude semi-comas within double quotes, how can regex?

in case of quotes want replacement:

var="hello;world"; var="hello;world";\r\n

and not this:

var="hello;world"; var="hello;\r\nworld";\r\n

thnak you!

you like:

s/;(?=[^"\n]*(?:"[^"\n]*"[^"\n]*)*$)/;\n/gm; # perl synax

if there no escaped quotes in strings, , strings not span multiple lines.

that replace:

;(?=[^"\n]*(?:"[^"\n]*"[^"\n]*)*(?m:$))

with

;\n

regex string replace quotes

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -