开发者

Simple PHP regular expression

Another regex problem. This is my HTML input -

Some text<br />

        This is really important text <br />

  This is another important text what I need.<br />

Please, help me to get the important text from this code. And suggest me some good stuff about reg. expressions, because I 开发者_JS百科feel pretty bad about asking you again.


Start with DOMDocument::loadHTML. Then take a look at the options available to you here (Document Object Model).


You have PHP tagged so are you using the PHP regex function to do the parsing? If so, I can help you write a reg. expression to match between the
tags. The first match is your first "important text" and the second match is your second.

Try something likes this:

$result = preg_match("/<br \/>(.*)<br \/>/", $input, $_matches);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜