PHP清理正则表达式 [英] php clean up regex
本文介绍了PHP清理正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,我可以从中清理php中的preg_match:
hey can i clean up a preg_match in php from this:
preg_match_all("/(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?/",$value,$match);
看起来像这样:
preg_match_all("/
(".$this->reg['wat'].")?
(".$this->reg['wat'].")?
(".$this->reg['wat'].")?
(".$this->reg['wat'].")?
(".$this->reg['wat'].")?
(".$this->reg['wat'].")?
(".$this->reg['wat'].")?
/",$value,$match);
现在每个空格都算作一次中断,因此搜索时不会返回任何发现.但它看起来更简洁易读,这就是为什么我问你知道的原因.我正在寻找正则表达式中以"/"结尾的字母之一.谢谢
right now each space, it counts as a ling break so it wont return any finds when searching. but it just looks cleaner and easier to read is why i ask you know. i was looking for one of those letters to add after the closing "/" in the regex. thanks
推荐答案
查看全文