in reply to Re: convert characters
in thread convert characters
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><>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: convert characters
by Utilitarian (Vicar) on Aug 27, 2009 at 12:39 UTC | |
by Anonymous Monk on Aug 27, 2009 at 16:26 UTC | |
by Utilitarian (Vicar) on Aug 27, 2009 at 18:17 UTC |