Reputation: 468
$str = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $str);
I have this code, this removes all encoded chars, how can I make it remove everything after the first match (including the first match)
Upvotes: 2
Views: 76
Reputation: 781096
Use a wildcard in the regexp:
$str = preg_replace('/[\x00-\x1F\x80-\xFF].*/', '', $str);
Upvotes: 4