Hi,
I have a string in PHP for example $string = "Blabla [word]";
I would like to filter the word between the '[' brackets.
The result should be like this $substring = "word";
thanks
Hi,
I have a string in PHP for example $string = "Blabla [word]";
I would like to filter the word between the '[' brackets.
The result should be like this $substring = "word";
thanks
preg_match('/\[(.*?)\]/', $string, $match);
$substring = $match[1];
Try:
preg_match ('/\[(.*)\]$/', $string, $matches);
$substring = $matches[1];
var_dump ($substring);