Skip to Content
Aug 07, 2008 at 07:56 AM

Regular Expression Help


Hi there,

can anyone help me with a regular expression.

I want to replace all delimiting commas in a CSV string with another character. The string contents look something like this...

1,10,Johnson,"Stores and Sales",High,10031984,paycycle1,"red,blue,green",full what I want to change it to is this...

1|10|Johnson|"Stores and Sales"|High|10031984|paycycle1|"red,blue,green"|full

My problem is with the regex syntax. The closest I have got to is...


..but this produces the result...

1,10,Johnson,"Stores and Sales",High,10031984,paycycle1,"red,blue,green"|full it only matches the commas after the last " delimited field.

Any help appreciated.


Graham Robbo