SneakyDave
Well-known member
I have a regular expression that replaces characters and numbers in a string. I use preg_replace and a regular expression of "/[a-z\d]/i" to do that.
Is there an easy way to extend that regex to include unicode characters?
Edited to add, after a bit of searching, could I reaplce [a-z] with this to include "any kind of letter from any language"?
Code:
$newtext= preg_replace("/[a-z\d]/i", "x", $originaltext);
Is there an easy way to extend that regex to include unicode characters?
Edited to add, after a bit of searching, could I reaplce [a-z] with this to include "any kind of letter from any language"?
Code:
$newtext= preg_replace("/[\p{L}\d]/i", "x", $originaltext);
Last edited: