From: Matma Rex Date: 2013-01-04T06:23:39+09:00 Subject: Re: Suggestions on parsing On Thu, 03 Jan 2013 22:13:14 +0100, Wayne Brissette wrote: > > Normally I would use read in the file, assign it to a variable and then use someVariable.split(" insFld(foldersTree,") >However, in this case I want everything from the beginning of that line too. Any ideas? Maybe a different way to parse this data? For a very simple ugly solution, you could use a regex with lookahead. someVariable.split(/(?= insFld\(foldersTree,)/) This would essentially split before every occurence (as the match itself would be zero-width; the contents of lookahead expression are not matched, only its "presence"). See http://www.regular-expressions.info/lookaround.html for more :)