Hi Johnny, thanks for the reply On May 26, 1:43 ¨Âí¬ Êïèîîù Íïòòéã÷òïôåº > > Do you need to handle nested strings? I'm not sure. I don't think so. I think the content is scrubbed beforehand to replace all embedded " with '. > > # The messy input > mess = [ " \"Only one line.\"", " \"line 1 ", " line 2.\"" ] > > # A single string, from the mess concatenated > single = mess.join "" > matches = single.scan /("[^"]*")/ > lines = matches.flatten > > # Pretty print the lines > p lines > I'm not sure about the 'join' solution for 2 reasons: 1) this array may be 1000's of lines long and I wonder what the performance will be like. 2) I'm thinking about getting rid of the initial array and reading the data straight from the input files. In that case, i would have to read in each line anyway. Having said that, I will give this a try and see how it works with the test data I have. Thanks! > > Have you considered writing a small lexer and parser? ¨Âïõ íáâå > better doing that, can handle weirder strings too. > No I haven't -- I don't know how to do that. yet. Cheers! Paul.