Given the following string:
{start} SubPattern1 {end}
....
{start} SubPattern2 {end}
....
{start} {start}SubPattern3{end} {end}
I need to find the regular expression that gives me the following result:
preg_match_all($regex, $string, $result);
print_r($result);
array(2
0 => array(3
0 => {start} SubPattern1 {end}
1 => {start} SubPattern2 {end}
2 => {start} {start}SubPattern3{end} {end}
)
1 => array(3
0 => SubPattern1
1 => SubPattern2
2 => {start}SubPattern3{end}
)
)
Thank you!
Edit
For visual purpose I wrote a multiline string. But I need that the expression works even if all the text is in a single line string. eg:
{start}SubPattern1{end}{start}SubPattern2{end}{start}{start}SubPattern3{end}{end}