作者:小新爱神起的小媳妇 | 来源:互联网 | 2023-10-13 06:42
PHP正则表达式、反则轮换字符串:PHP正则表达式、反则替换字符串代码:??反则,保留除了A-Za-z0-9@\*的字符???$word[emailprotected]*5822?
PHP 正则表达式、反则替换字符串
代码:
?
? //反则,保留除了A-Za-z0-9@\*的字符
??? $word = "6915-615@JPY11890*5822?" ;
??? $par = array('/[^A-Za-z0-9@\*]/');?
??? $word = preg_replace($par, "", $word);
??? echo ??? $word;
??? echo "
";
??? //正则,剔除A-Za-z0-9@\*字符
??? $word = "6915-615@JPY11890*5822?" ;
??? $par = array('/[A-Za-z0-9@\*]/');?
??? $word = preg_replace($par, "", $word);
??? echo ??? $word;
结果:
?
6915615@JPY11890*5822
-