<?php $tweet = "hello world #dontremoveme foobar http://example.com/#dontremoveme #remove #removeme #removeüäüö"; $res = preg_replace("/ #\p{L}+\b(?!\s+\p{L})/u", '', $tweet); echo $res,"\n";
You have javascript disabled. You will not be able to edit any code.