Мне нужно заменить полный тег bbcode пустым пробелом (в данном примере на «M»)
На данный момент это мой php код
$string ="
hello
[MSG='user1, comment: 253434, userid: 1232'] TEXT1[/MSG]
[MSG='user2, comment: 343425, userid: 4231']
TEXT2
[/MSG]
[MSG='user3, comment: 234345, userid: 1423']
TEXT3
[/MSG]
[MSG='user4, comment: 253434, userid: 123242']
TEXT4
text 4
text 4
[/MSG]
[MSG='user5, comment: 251234, userid: 1652'] TEXT5[/MSG]
hello
";
regex замена
$string = preg_replace("[MSG=\'(.*?)\'](.*?)[\/MSG]", "M", $string);
ОЖИДАЕМЫЙ ВЫХОД
hello M M M M M hello
Я использую это регулярное выражение [MSG=\'(.*?)\'](.*?)[\/MSG]
что с ним не так?