Thank you Shawn!  That worked too!

You guys are great!  :)

Troy

-----Original Message-----
From: Shawn [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 9:19 PM
To: Troy May; [EMAIL PROTECTED]
Subject: Re: Searching for a specific spot on a page


my $string="someHTML";
my @split=split(/(<!--news feed-->)/,$string);
my $newstring=@split[0,1].$replacement.@split[3,4];

or

my $string="someHTML";
$string=~s/(.*?<!--news feed-->).*?(<!--news feed-->.*)/$1$replacement$2/ms;

Not sure if the 'm' modifier is needed on the substitution...

Anyway, these should do what you are looking for...but I haven't tested
them.

Shawn

----- Original Message -----
From: "Troy May" <[EMAIL PROTECTED]>
To: "Ramprasad A Padmanabhan" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 11:06 PM
Subject: RE: Searching for a specific spot on a page


> Thank you, that worked!  :)
>
> By the way, I'm thinking of a new thing that I want to do.  How would I
> alter this to open another page the same way, but replace the html code
> BETWEEN two "<!--news feed-->" with the same $html?  I could rename the
> second "<!--news feed-->" if that would be easier.  But I'm looking at
> regexes to do this, but I'm not real good with them.  This won't be just
> text, it won't be just digits, etc.  It would be a combination of
> everything.  (complete HTML coding)
>
> Any ideas on this one?  Or should I start a new topic?
>
> Thanks again!
>
>
> -----Original Message-----
> From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 12, 2002 10:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Searching for a specific spot on a page
>
>
> Do it this way
>
>
> if( open(IN,$file)) {
>    local($/)=undef;
>    $filestr = <IN>;
> }
> close IN;
> $SEARCH = '<!--news feed-->';
> $filestr=~s/$SEARCH/$SEARCH $HTML/;
>
> open(OUT,">$file") || die "$!";
> print OUT $filestr;
> close OUT;
>
>
> Troy May wrote:
> > Hello,
> >
> > I'm trying to do a news feed type of script from an admin page.  I need
to
> > open up a page and find the line that starts with "<!--news feed-->" and
> > insert "$html" right after that.  I'm drawing a blank on how to search
for
> > that line.  This is probably easy, but I can't think of how to do it.
> >
> > Thanks in advance!
> >
> > Troy
> >
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to