< td>和< / td>内的正则表达式 [英] Regular expression for contents within <td>and</td>
本文介绍了< td>和< / td>内的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要找到一个正则表达式用于查找PHP中的内容和标签。我已经尝试过......
I need to find a regular expression to use for finding the content within and tags for use in PHP. I have tried...
preg_split("<td>([^\"]*)</td>", $table[0]);
但是这给了PHP错误...
But that gives me the PHP error...
Warning: preg_split(): Unknown modifier '(' in C:\xampp\htdocs\.....
任何人都可以告诉我我做错了什么?
Can anyone tell me what I am doing wrong?
推荐答案
试试这个:
Try this:
preg_match("/<td>([^\"]*)<\/td>/", $table[0], $matches);
但是,作为一般规则,请,不要试图用正则表达式解析HTML ...: - )
But, as a general rule, please, do not try to parse HTML with regexes... :-)
这篇关于< td>和< / td>内的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文