"First Line","This line should remain unchanged" >"Second Line","This one >should change from 3 lines >to one"What I want the csv file to look like is
"First Line","This line should remain unchanged" >"Second Line","This one should change from 3 lines to one"To this end I've tried the following:
local lcInFile, lcOutfile, loReg >lcInFile = filetostr(getfile('txt')) > >loReg = create('vbscript.regexp') >with loReg > .Global = .t. > .IgnoreCase = .t. > .Pattern = '[^"]\n' * Your problem is here. All DOS text files use a CR/LF pair at EOL, * so the pattern you want is: .Pattern = '[^"]\r\n' > lcOutFile = .Replace(lcInFile, ' ') >endwith > >strtofile(lcOutFile, getfile('txt'))in the hope that I'll match all newlines not immediately preceeded by a quote character with a space character. Unfortunately, I'm also replacing the newline characters that are preceeded by a quote character, so the end result is
"First Line","This line should remain unchanged" "Second Line","This one should change from 3 lines to one"I'm obviously doing something wrong with the pattern, but I can't figure out what.
oReg=CREATEOBJ('VBScript.RegExp') >>oReg.Global = .T. && apply to all occurances >>oReg.IgnoreCase = .T. && case-insensitive >>oReg.Pattern = '\([^\)]*\)' && a (, followed by any number of characters, followed by a ) >>REPLACE horse_name with oReg.Replace(horse_name,'')>>