Regex pattern to match carriage returns inside quotation marks?
Hello all,
Anyone here who can help me or point me in the right direction?
I have a CSV file like below...
ID,Name,Comment,Date
5,"Steve","Likes football and pizza",20090909
6,"Lisa","Likes to cook",20090905
7,"Nate","Reads a lot of books
Likes to run marathons",20090908
...and the carriage return in Nates comment creates problems for me, so I need to replace it with something else. A simple Replace will not work since it will turn the entire file into one line. I believe I need to use a pattern here - but I don't know how it should look.
This is what I'm trying to do, and "the_pattern" is where I fail (strText contains the entire CSV text):
Dim RE
Set RE = new RegExp
RE.IgnoreCase = True
RE.Global = True
re.Pattern = "the_pattern"
strNewText = re.replace(strText, "NEWLINE")
I guess the regex pattern should match something like "carriage returns inside quotation marks", so I can use it to replace those carriage returns with something else (to later on convert them back to carriage returns).
Any help or pointers on this is highly appreciated. I've tried on my own for a while, but cannot seem to do it right.
/Miikee
|