我有一个输入字符串:
$str1 = "some usefull text and garbage `~#@!&^*(()}{./";
$str2 = "`~#@!&^*(()}{./";
$result = Exclude with regular expressions all symbols from str1, which are in str2.
$result = "some usefull text and garbage";
什么正则表达式会简单地删除我指定的所有符号?如何以正确的方式过滤它?谢谢!
最佳答案
你不需要正则表达式:
$clean_str = str_replace(str_split($str2), '', $str1);
您可能想要修剪
结果字符串。
关于php - 在 php 中使用正则表达式查找结果 str,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8071016/