时间:2021-07-01 10:21:17 帮助过:4人阅读
代码:
?
? //反则,保留除了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
-