preg replace to remove bbcode quote
Could someone give me an example of how to I can remove
开发者_StackOverflow[QUOTE=author;3095231]
Author being the authors name, and 3095231 being the post.
I want to use preg replace, or anything similar but not sure how and was wondering for an example, I believe it would be something like [QUOTE=(.+?)] and i don't know the rest.
Your regex looks almost right to me, you must escape the brackets though.
Assuming it's in PHP, the corresponding code would look like
$text = preg_replace('/\[QUOTE=(.+?)\]/', '', $text);
The regular expression you're looking for is
s/\[QUOTE=[^\]]+\]//
精彩评论