I want to delete this from a string:
[QUOTE=*] * [/QUOTE]
.* kan be anything
Can anyone please provide a pattern that I can use?
I want to delete this from a string:
[QUOTE=*] * [/QUOTE]
.* kan be anything
Can anyone please provide a pattern that I can use?
$string = preg_replace('/\[QUOTE=[^\]]*\].*\[\/QUOTE\]/', '', $string);
Jhongs answer is perfect, it will leave you with the content from the both *'s.
However, if you need the parts separately you can make a small adjustment and add capturing groups like so:
if (preg_match('%\[QUOTE=([^\]]*)\](.*)\[/QUOTE\]%', $subject, $matches))
{
...
}
The *'s will be at $matches[1] and $matches[2].