Hello, here's a problem anyone somewhat experienced with regular expressions probably would have the answer to.
How do you match all occurances of "variable<subpattern>variable" where the <subpattern> itself contains occurances of the full pattern.
Here's an example:
$pattern = "/<!-- BEGIN (.?) -->(.?)<!-- END \1 -->/is";
<!-- BEGIN somename1 --><p>here's the subpattern content</p><!-- END somename1-->
<p>blah, blah, blah</p>
<!-- BEGIN somename2 --><p>some other text</p>
<!-- BEGIN somename3 --><p>the subpatterns subpattern</p><!-- END somename3 -->
<p>more text</p>
<!-- END somename2-->
with a preg_match_all that would match
match1.
<!-- BEGIN somename1 --><p>here's the subpattern content</p><!-- END somename1-->
match2.
<!-- BEGIN somename2 --><p>some other text</p>
<!-- BEGIN somename3 --><p>the subpatterns subpattern</p><!-- END somename3 -->
<p>more text</p>
<!-- END somename2-->
this matches the stuff between somename1 and somename2 but how do you get it to also match somename3 and (not illustrated by the example), if you wanted also somename4 inside the BEGIN and END tags of somename3, and inside of somename4 any occurances of END, BEGIN and subpattern of somename5, and so on, and so on.