From: Ne Scripter Date: 2009-10-21T00:27:49+09:00 Subject: Complex GSUB query Hello all, I am struggling with something and I have yet been able to find anything that may help me. I have a string like follows: string = "\"bloggs, Joe (JBloggs, INFO)\" joebloggs, \"bloggs, Bill (BBloggs, INFO)\" billbloggs" I want to break this string up into two entries using a _ seperator, one for Joe and the other for Bill. I could do this with a simple string.gsub(",", "_") However the problem with doing this is that there are commas elsewhere in the string. So what I need to say is, if the comma is outside of "" (quotes) replace it with the _ Could anyone possibly help me with this? Thanks -- Posted via http://www.ruby-forum.com/.