Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Comment Removal

by rnahi (Curate)
on Oct 16, 2005 at 20:26 UTC ( #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>


Comment on Re: Comment Removal
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-08-31 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls