我有这样的表达:如何使用preg_split()删除方括号?
The Exorcist's [Restored Version] (xvid110-sickboy88)
而想输出是这样的:
The Exorcist's Restored Version xvid110 sickboy88
请帮助在此先感谢。
我有这样的表达:如何使用preg_split()删除方括号?
The Exorcist's [Restored Version] (xvid110-sickboy88)
而想输出是这样的:
The Exorcist's Restored Version xvid110 sickboy88
请帮助在此先感谢。
不需要正则表达式。 str_replace()
将完成这项工作。如果它的第一个参数是一个数组,但第二个参数是一个字符串,则第一个数组的所有元素将被第二个字符串参数替换。
$input = "The Exorcist's [Restored Version] (xvid110-sickboy88)";
$str = str_replace(array("[", "]", "(", ")"), "", $input);
echo $str;
// The Exorcist's Restored Version xvid110-sickboy88
+1。适合正确工作的正确工具。因为在其中一个房间里有苍蝇,所以不需要对建筑物进行核武器。 – 2012-03-16 16:45:51
$string = "The Exorcist's [Restored Version] (xvid110-sickboy88)";
$simbols = array("[", "]", "(", ")");
echo str_replace($simbols , "", $string);
* 尝试这是工作........ 中间乡绅括号前使用正斜杠*
$关键字=使preg_split(“/ [[]]/“,”[超文本]语言,编程“);
print_r($ keywords);
我不认为'preg_split()'是这种方式... – 2012-03-16 16:43:05
当然,你需要删除所有的括号是$ string = str_replace(array('[',']', '(' ')'), '',$字符串); – 2012-03-16 16:43:20