That worked perfectly....thanks!

-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 1:42 AM
To: T&C Winquist
Cc: [EMAIL PROTECTED]
Subject: Re: substitution regular expression


T&C Winquist wrote:
> It seems like everytime I do a regular expression that it's a new case and
I
> realize how much I don't know about them.
>
> $rawPage contains the header and html code collected from an HTTP request.
>
> I need to split this variable into two variables.
>
> $header will contain all the information BEFORE <html>
> $page will contain all the information including and following <html>
>
> The white spaces and new lines should all stay intact.
>
> I would like it to be in this type of format.  I can't figure out the part
> between brackets:
>
> my $header = $rawPage =~ s|(<html>[through the end of the string contained
> in $rawPage variable])||i;
> my $page = $1;

One way:

$rawPage =~ /^(.*?)(<html>.*)$/is;
my $header = $1;
my $body = $2;

--
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic
http://www.todbe.com/

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to