text text text
text text text
{test}
content
content
content
{/test}
text text text
text text text
i need to get two separate results from the above string:
1.
{test}
content
content
content
{/test}
2.
content
content
content
so, what should be the two separate regular expression patterns for PHP to get the above two results
What about something like this :
Which will get this kind of output :
So, in
$m[0]you have the whole matched string (ie tags+content), and in$m[2]you only have to content between the tags.Note I have used “generic” tags, and not specifically “
test” ; you can change that if you’ll only have “test” tags.For more informations, you can take a look at, at least :
preg_match