I have an example:
some text lorem ipsum ... {gallery}../2021/some_string_2021/some_other_string{/gallery} ... other lorem ipsum
And I need to get out only the ../2021/some_string_2021/some_other_string
.
How can I ignore all before {gallery}
and all after {/gallery}
while being able to capture ../2021/some_string_2021/some_other_string
?
Tried to figure it out but cannot make it work neither with some sort of combination with:
preg_match_all("/\[(.*?)\]/", $text, $matches);
print_r($matches[1]);
if( preg_match( '!\(([^\)]+)\)!', $text2, $match ) )
echo $match[1];
Maybe I should first change [] to {}, and then try it with (.*?){(.*?)}
?