Re: Create a string array of all comments in a html file...
- From: William James <w_a_x_man@xxxxxxxxx>
- Date: Sun, 30 Sep 2007 11:37:51 -0700
On Sep 30, 10:39 am, sophie_newbie <paulgeele...@xxxxxxxxx> 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.
E:\Ruby>irb --prompt xmp
"<!-- Comment
here -->And <i>so</i> funny!
<p>It was a dark and stormy night.
</p><!-- Comment <> -->".scan(/<!--.*?-->/m)
==>["<!-- Comment\nhere -->", "<!-- Comment <> -->"]
.
- References:
- Create a string array of all comments in a html file...
- From: sophie_newbie
- Create a string array of all comments in a html file...
- Prev by Date: Re: Python and SSL
- Next by Date: Re: Can you please give me some advice?
- Previous by thread: Re: Create a string array of all comments in a html file...
- Next by thread: Re: Create a string array of all comments in a html file...
- Index(es):
Relevant Pages
|