From: James Gray Date: 2009-05-01T23:37:23+09:00 Subject: Re: FCSV importing file to Excel On May 1, 2009, at 7:35 AM, Mark Thomas wrote: > On Apr 30, 9:06 pm, James Gray wrote: >> On Apr 30, 2009, at 6:30 AM, Mark Thomas wrote: >> >>> On Apr 29, 8:46 am, James Gray wrote: >> >>>> "=HYPERLINK(""http://www.radiofreetexas.org/"", ""ClickHere"")" >> >>>> Unfortunately, I can't think of an easy way to break up data like >>>> that. You would likely need to build your own parser to handle it. >> >>> You mean like this? >> >>> str.gsub(/"(?!")/, "") >> >> I'm not real sure what you are aiming for here. I doubt this helps >> read the data in the intended manner: > > That's what I get for reading too quickly to get the entire context. > The regex de-escapes the string above. I realize now you were talking > about parsing the invalid CSV. The way I see it, the OP has two > options: > 1. Not use FCSV > 2. Make his CSV valid before parsing > > If the above is his only problem, he can do #2 this way: > > line.gsub!(/=HYPERLINK\((.*?)\)/) { |hyp| > hyp.gsub(/\"/,'""') > } That's not a general solution. What if I had a field like this? "some junk here =HYPERLINK(""…"", ""…"")" Your solution damages that content. James Edward Gray II