Was there an example there? "Something like..."? I've currently got something which works similarly to how you described, but the bit which is causing problems is when there is a comma inside an already quoted field - in my example, the "China, people's republic of" bit. It seems like a simple ,"[^"]*,[^"]*", should work, ... and it does! :S Gah, it didn't work earlier. :@
On 12/08/05, Ben Doom <[EMAIL PROTECTED]> wrote: > Well, this can be done with regex, but I would probably skip it. Check > first and last chars, and prepend/append ~BLANK~ as necessary, replace() > quotes with ~QUOTE~, replace commas with "," and then prepend/append > with quotes. Something like > > The code might not be as pretty, but it'll be easier to debug. > > --Ben > > Peter Boughton wrote: > > I have some data resembling the following: > > Mr,Bob,Smith,Bobs House,Bobs Road,,,Bobs City,,Bobs Postcode,"China, > > People's Republic of",[EMAIL PROTECTED],, > > > > And I would like to convert it to this: > > "Mr","Bob","Smith","Bobs House","Bobs Road","~BLANK~","~BLANK~","Bobs > > City","~BLANK~","Bobs Postcode","China~COMMA~ People's Republic > > of","[EMAIL PROTECTED]","~BLANK~","~BLANK~" > > > > Can anyone provide a/some tidy regex statement(s) that will do this for me. > > > > Bonus points for being able to cater for things such as this: > > Mr,Bob,Smith,Bobs "Fun" House,Bobs Road... > > to > > "Mr","Bob","Smith","Bobs ~QUOTE~Fun~QUOTE~ House","Bobs Road"... > > but I don't think that's needed for my current set of data. > > > > A thousand thankyou's to anyone able to help. > > > > Peter > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:21:921 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
