I am trying to match everything inside of an HTML file that is located
between a
<!--H and H-->
Right now I have
thePage.sub!(/<!--H((.*)|(\n))+H-->/, stuff)
where thePage is a string that holds the HTML page and stuff is a string
I want to sub into thePage.
This does not seem to be working.
Any suggestions?
-Matthew Margolis
I am trying to match everything inside of an HTML file that is located
between a
<!--H and H-->
Right now I have
thePage.sub!(/<!--H((.*)|(\n))+H-->/, stuff)
try this
thePage.gsub!(/(<!--H)(.*?)(H-->)/, $1 + stuff + $3)
···
On Tue, 8 Mar 2005 07:00:52 +0900, MATTHEW REUBEN MARGOLIS <mrmargolis@wisc.edu> wrote:
where thePage is a string that holds the HTML page and stuff is a string
I want to sub into thePage.
This does not seem to be working.
--
Simon Strandgaard
Try with:
thePage.sub!(/<!--H.*H-->/m, stuff)
The "m" enables multi-line mode. Otherwise, the \n is treated as end of line
and the substitution works on a per-line basis.
Martin
···
On Monday 07 March 2005 4:00 pm, MATTHEW REUBEN MARGOLIS wrote:
I am trying to match everything inside of an HTML file that is located
between a
<!--H and H-->
Right now I have
thePage.sub!(/<!--H((.*)|(\n))+H-->/, stuff)
> I am trying to match everything inside of an HTML file that is located
> between a
> <!--H and H-->
> Right now I have
> thePage.sub!(/<!--H((.*)|(\n))+H-->/, stuff)
try this
Sorry too fast.. forgot the multiline flag
thePage.gsub!(/(<!--H)(.*?)(H-->)/m, $1 + stuff + $3)
···
On Mon, 7 Mar 2005 23:12:18 +0100, Simon Strandgaard <neoneye@gmail.com> wrote:
On Tue, 8 Mar 2005 07:00:52 +0900, MATTHEW REUBEN MARGOLIS > <mrmargolis@wisc.edu> wrote:
--
Simon Strandgaard