in reply to Re^3: close end tag
in thread close end tag
Hi, I have replaced the '<' with < and '>' with >#!/usr/bin/perl while($line = <DATA>){ @valid_entities= ('<a>','<abbr>','<acronym>'); my %htmlenties = map { $_ =>1 } @valid_entities; $line =~ s/(<(\w+?)>)/exists $htmlenties{$1} ? $1 : defined ($2) ? "& +lt;$2>" : "<"/eg; print $line; } __DATA__ <helloe>How r u <a> www.google.com</a> <Hi>How r u </hi>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: close end tag
by Anonymous Monk on Aug 27, 2009 at 09:07 UTC |