in reply to non-greedy incremental regular expression?
You are right to suspect that your regex is greedy: /<blah>(.*)<\/blah>/ matches the entire string, capturing:
red</blah><blah>white</blah><blah>blue
Read perlre for more about greedy regexes, but suffice it to say, I think you want /<blah>(.*?)<\/blah>/
|
|---|