I have a string ryyyr #rrrr iituut iit #Google rrr #Tom65
In this string I am looking for all tags by regex /^#[A-Za-zА-Яа-я0-9_]{4,20}/
And I want to replace all found tags with the word penis, But for some reason nothing works
public static function findHashTags () {
$string = 'ryyyr #rrrr iituut iit #Google rrr #Tom65';
$pattern = '/^#[A-Za-zА-Яа-я0-9_]{4,20}/';
$replacement = 'penis';
$a = preg_replace($pattern, $replacement, $string);
return $a;
}