Hi, I've got this: string = "start {{blah {{ }} outside\n{{ {{ }}\n}} bye" pre = Regexp.escape("{{") post = Regexp.escape("}}") string.split(/#{pre}(.*?)#{post}/).each do |p| p p end which prints: "start " "blah {{ " " outside\n" " {{ " "\n}} bye" which is close to what I want. I really want: "start " "blah {{ " " outside\n" " {{ }}\n" " bye" Is there a way to do such a thing with a regex, or do I need to resort to a scanning technique, keeping track of the nested elements? thanks, -joe