Quick post that probably won't help if I try to remember how to do this. Large txt file (happens to be vCalendar), and needed to chop out whole heap of text to make it v1 compatible for my mobile phone... Anyhoo, a whole bunch of text between two strings had to come out whilst open in TextWrangler so this was the regex used: DTSTAMP:[\S\s]*?(?=SUMMARY) The first question mark after the "*" make the match 'non-greedy' then the (?=yourKeyWordHere) bit is a lookahead assertion. Along with lookbehind they're collectively called "lookaround" http://www.regular-expressions.info/lookaround.html