我正在尝试从IMDb中获取人体高度,但该行包含#
,它表示PHP中的注释(例如# The comment as follows
)。这里是如何看起来像来自IMDB的源代码:从IMDb获取人体高度
<h4 class="inline">Height:</h4>
5' 7" (1.70 m)
这是我尝试的正则表达式:
<h4 class="inline">Height:</h4>\n([0-9' &#;(.)m]+)
我应该怎么做,以防止它后发表评论正则表达式的其余部分#
角色?
在此先感谢!
编辑
这里是添加\
正则表达式的结果:
[取来自这里的建议。](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – 2012-07-26 23:08:30
请勿使用RegEx。 http://simplehtmldom.sourceforge.net/或http://php.net/manual/en/book.dom.php – 2012-07-26 23:08:59
用\ \转义它吧? – Radix 2012-07-26 23:09:45