From the above code the output which i got is#!/usr/bin/perl while($line = <DATA>){ @valid_entities= ('<a>','<abbr>','<acronym>'); my %htmlenties = map { $_ =>1 } @valid_entities; @valid_entities= ('a','abbr','acronym','br');# remove tags my %htmlenties = map { $_ =>1 } @valid_entities; $line =~ s/<(\/?([^>]*?)\/?)>/exists $htmlenties{$2} ? "<$1>" : defin +ed ($1) ? "<$1>" : "<"/xeg; print $line; <helloe>How r u <a> www.google.com</a> <hi>How r u </hi><et,-2><>
But the expected output is<helloe>How r u <a> www.google.com</a> <hi>How r u </hi><et,-2><>
As '<hi>' as the '</hi>' I shouldn't replace it.<helloe>How r u <a> www.google.com</a> <hi>How r u </hi><et,-2><>
In reply to Re^2: convert characters
by Anonymous Monk
in thread convert characters
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |