Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Comment Removal

by rnahi (Curate)
on Oct 16, 2005 at 20:26 UTC ( [id://500609]=note: print w/replies, xml ) Need Help??


in reply to Comment Removal

Here is yet another method, based on Regexp::Common:

use strict; use warnings; use Regexp::Common qw/comment/; # <== my $html = <<'END_HTML'; <p><b>Hello World</b> <!-- This comment would need to be removed from the entry --> </p><font color=red>It is Sunday!</font> <!-- also this--><p>this should stay here</p><!--this should go--> END_HTML $html =~ s/$RE{comment}{HTML}//g; # <== print "$html\n";

Result:

<p><b>Hello World</b> </p><font color=red>It is Sunday!</font> <p>this should stay here</p>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://500609]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-26 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found