On Thursday, Sep 4, 2003, at 17:55 US/Pacific, Hanson, Rob wrote:
$text =~ s|(<head>).*?<title>.*?</title>.*?(</head>)|$1$2$3|s;
actually that should be:
$text =~ s|(<head>).*?(<title>.*?</title>).*?(</head>)|$1$2$3|s;
way stylish! I actually like.
But assumes that there will be a title element - otherwise it will fail and not clear out the other stuff in the head element.
ciao drieux
---
my $text ='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>The J Group</title>
<style type="text/css">
<!--
pre { font-size: 14px; font-weight:bold }
//-->
</style>
<meta name="generator" content="BBEdit 6.5.2">
<base href="http://www.wetware.com/drieux/CS/Proj/TPFH/the_j_grp.html">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font size=2 face=arial>This is the test file contents<br>
<p>
blah blah blah.........
</body>
</html>';
#$text =~ s|(<head>).*?(</head>)|$1$2|s;
$text =~ s|(<head>).*?(<title>.*?</title>).*?(</head>)|$1$2$3|s;
print $text ;
will generate a flatter
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="en"> <head><title>The J Group</title></head> <body text="#000000" bgcolor="#FFFFFF"> <font size=2 face=arial>This is the test file contents<br> <p> blah blah blah......... </body> </html>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]