hey guys i'm having a slight problem with getting the correct match, which i know is down to my regex pattern.
with my first result i get [/name/hello[/second] but im after the result of [/name/hello[/second]] with the closing bracket at the end.
is it possible for me to match that?
$pattern = "hello[/name/hello[/second][/bye]";
if (preg_match_all('/\[(.*?)\]/', $pattern, $matches))
{
print_r($matches)
}
Array
(
[0] => Array
(
[0] => [/name/hello[/second] // --- > [/name/hello[/second]]
[1] => [/bye]
)
[1] => Array
(
[0] => /name/hello[/second
[1] => /bye
)
)
thank you