Hello, @mark-yorkovich, @peterjones, @alan-kilborn, @lycan-thrope and All,
Of course, the generic regex satisfies the @mark-yorkovich’s goal ! But if we try to think more deeply about the problem, the solution is almost obvious !
Mark said :
I have a CSV file with comma-separated fields, and double quotes for each field, except the first field which is an ID field.
Thus, as a valid field is always surrounded by double-quotes, this means that the line-breaks which need to be replaced with a literal , must be :
Not immediately preceded with a
double-quote character
AND
Not immediately followed with a
double-quote character
Hence, the following regex S/R :
SEARCH (?<!")\r\n(?!")
REPLACE ,
Untick all box options of the Replace dialog
Select the Regex expression search mode
Move to very beginning of your CSV file
Click once on the Replace All button ( or several times on the Replace button )
Best Regards,
guy038
P.S. :
As explained in a recent post, do not use the simplified search syntax (?<!")\R(?!") !
Of course, this method does not work if fields, near the line break, may not be followed / preceded with a " character !