3
Greetings, I have to remove any occurrence of texts between brackets. As for example:
Ex.: [Text in square brackets] Text out of square brackets. Output would be: "Text out of square brackets";
I tried using the following Regex:
$string = "[Texto entre colchetes] Texto fora do colchetes";
$String = preg_replace("[\/(.*?)\]/",'',$string);
echo $string;
But I was unsuccessful.
Brackets are part of the construction of a regular expression. If you want to have it in string, you will need to escape them.
– Woss