Reputation: 1521
I have a string, e.g. /test/
and I'd like to mantain only the lowercase.
How can I do it with preg_replace
?
$string = '/test/';
$new_string = preg_replace('?????', '', $string);
$new_string = 'test';
Upvotes: 1
Views: 306
Reputation: 30690
It's simpler than you think:
$string = preg_replace('/[^a-z]/', '', $string);
Upvotes: 5