Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
open (FILE, $filename); while(<FILE>){ # walk each file my $line = $_ ; chomp $line; #grabbing and printing everything between the body tags if (/<body.*?>/i ... /<\/body.*?>/i){ # this is a body line # extract the body ##########################3 ###### this is where i need to put an if else statement that does not +hing if http:// and .html are found in the same line ##Changing .html to .asp at the end of every link that do not +belong to an external link s/(href=.+?\.)html/$1asp/gi; $body_temp = $_; $body_temp =~ s/(.*?)\<body\>(.*?)\<\/body\>/$2/i; chomp($body_temp); $body = "$body_temp" ; # Write the body to the output file print OUTFILE $body . "\n"; } } close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Changing .html to .asp on some links but not others
by tye (Sage) on May 02, 2001 at 01:00 UTC | |
|
Re: Changing .html to .asp on some links but not others
by Anonymous Monk on May 02, 2001 at 01:18 UTC | |
|
Re: Changing .html to .asp on some links but not others
by how do i know if the string is regular expression (Initiate) on May 02, 2001 at 01:07 UTC | |
|
Re: Changing .html to .asp on some links but not others
by astanley (Beadle) on May 02, 2001 at 00:50 UTC | |
by isotope (Deacon) on May 02, 2001 at 01:15 UTC |