HighDots Forums  

Re: is my HTML tag stripper up to par?

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss Re: is my HTML tag stripper up to par? in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jonathan Stowe
 
Posts: n/a

Default Re: is my HTML tag stripper up to par? - 08-25-2003 , 04:36 AM






In comp.lang.perl.misc Dan Jacobson <jidanni (AT) jidanni (DOT) org> wrote:
Quote:
Is my HTML tag stripper up to par?
$ cat striptag
#!/usr/bin/perl -w
#usage example: striptag font div < file.html
read( STDIN, $_, -s STDIN );
foreach my $tag (@ARGV) { s@</?$tag.*?>@@sig }
print;
As has already been pointed out this will not work for a lot of cases.

Lest anyone should look at this thread hoping for a working one:

#!/usr/bin/perl -w

use strict;

use HTML::Parser;

my $parser = HTML::Parser->new( text_h => [ sub { print shift; },"dtext" ]);


$parser->parse_file(*STDIN);

/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
Quote:

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.