Using Regex to remove Carriage Returns in a CSV file in Notepad++
csv, notepad++, regex
Solution
After much hunting around StackOverflow I found a regex pattern suggested for a similar problem that I only had to modify slightly from single quote to double quote. I ran it in PERL. It worked great! Unfortunately I can't find the original post to give credit where credit is due.
Anyway, this is what I finally used. Thanks everyone for your help!
$string123 =~ s/((?:^[^"]*"|(?!^))[^"]*?(?:"[^"]*"[^"]*?)*?)(\n{1,})/$1/g;
Problem
I have a CSV file I need to clean up. This is a one-time thing so I'd like to do it in Notepad++ if possible. The CSV file has two fields, one of which is wrapped in quotes. I'd like to remove any Carriage Returns from within the quoted field. I was trying to use this pattern but can't get it quite right... ``` (.*)\"(.*)\n(.*)\"(.*) ``` Also correct me if I am wrong, but I presume the "replace with" value would be something along the lines of: ``` \1\2\3\4 ``` Thanks in advance. I'm also open to alternate solutions such as a quick and dirty PERL script.