On Sep 30, 10:39 am, sophie_newbie <[EMAIL PROTECTED]> wrote:
> Hi, I'm wondering how i'd go about extracting a string array of all
> comments in a HTML file, HTML comments obviously taking the format
> "<!-- Comment text here -->".
>
> I'm fairly stumped on how to do this? Maybe using regular expressions?
>
> Thanks.

>>> from pyparsing import htmlComment
>>> htmlComment.searchString("""<!-- Comment
... here -->And <i>so</i> funny!
... </p><!-- Comment <> -->""").asList()
[['<!-- Comment \nhere -->'], ['<!-- Comment <> -->']]

-- Paul



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to