PHP替换函数,一些正则!

替换文本中出现的字母(大写+小写)

$row= preg_replace("/[a-z'A-Z]/i",null, $str);

替换文本中出现的字母(大写)

$row= preg_replace("/[a-z']/i",null, $str);

替换文本中出现的数字

$row= preg_replace("/[0-9']/i",null, $str);

替换文本中出现的数字+字母

$row= preg_replace("/[^x{4E00}-x{9FFF}]{1,4}/u",null, $str);
原文地址:https://www.cnblogs.com/shcolo/p/3331172.html