I am trying to setup a regex that will detect [quote]???[/quote] and will remove it.
This is what I have but it is not working:
$post['body'] = preg_replace("/\[quote\](.+?)\[\/quote\]/is", '', $post['body']);
Can anyone point me in the right direction?
I also want to remove any line brakes before or after the [quote]???[/quote].
Here's my test with your script:
And my Output:
You can see: [quote]???[/quote] is removed.
I think your problem is anywhere else. Check the Value of $post['body']!
Maybe it is a misspelling and you meen $_POST['body']?
Just figured out my own issue.
$post['body'] = preg_replace("/\[quote\](.+?)\[\/quote\]/is", '', $post['body']);
$body = trim(rtrim($post[0]['body']));