From: Wayne Blair Date: 2001-06-05T03:19:15+09:00 Subject: [ruby-talk:16213] Re: Parsing Question Hey, I always make a small error when I post some code. I forgot to dup the commandLine string in my previous post. This is what it should have been: def parseCommandLine(aString) unparsedCommands=aString.dup # need dup here point is to not mutate string arg parsedCommands = [] while # remove commands from unparsedCommands as we find them unparsedCommands.sub!(/([a-zA-Z0-9]+)|"(\"|[^"])*"/) { parsedCommands << $&; ""} end return parsedCommands end