I have content with tokens and want to strip all token which DOES NOT start with test. For example I have content:
$content = 'Hello [test:username]. What are you [token:name]';
$string = preg_replace('/\[test(.*)\]/', '', $content);
This work but replace with empty string all token which start with test. I want opposite which does not start with test and replace all another. How should I change regular expression. I want to get this result after preg_replace:
$content = 'Hello [test:username]. What are you';
^at the beginning of your pattern...