开发者

parsing HTMl with REGEX [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. 开发者_运维百科 Closed 11 years ago.

Don't yell at me!

i have seen many threads claiming that HTML cannot be properly parsed with REGEX.

i do not believe this is so. NB - i love REGEX and try to use it everywhere i can.

please convince we with any of the following:

1) HTML code that cannot be properly parsed with REGEX

2) an authority on the subject saying it is so

3) personal example of somewhere where using REGEX to parse HTML went horribly wrong for you.

thank you, and i hope this clears the subject up for me.


Can you find every paragraph in the following code using a regular expression?

<p  class =  "hello"    >
    Hello World
    <!-- I'm a comment, so <p>the tags</p> inside me must be ignored! -->

<P CLASS=hello>Hello World again!</p >

<p class="<p>">
    Hey, what about some CDATA? <![CDATA[ Let's put some <p> here too! ]]>
</p>

<p/>
    Good bye!
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜