How to clear all html tag in document?

Discussion in 'Perl Misc' started by max, May 28, 2005.

  1. max

    max Guest

    How to clear all html tag in line (or document) ?
    All tags have "<" on start, and ">" at the end of tag. Eg <table>, </table>,
    <div align="left">, <td align="left" bgcolor="#000099"> ....
    I make program that work character by character, and control if is start is
    "<", and end ">".
    Please help me I now those Perl programmers do that on easier way! How?

    Thanks
     
    max, May 28, 2005
    #1
    1. Advertising

  2. max wrote:
    > How to clear all html tag in line (or document) ?


    Is there anything wrong with the answer in the FAQ 'perldoc -q "remove
    HTML"'
    "How do I remove HTML from a string?"

    > Please help me I now those Perl programmers do that on easier way!
    > How?


    Trivial. They just follow the suggestions in the FAQ.

    jue
     
    Jürgen Exner, May 28, 2005
    #2
    1. Advertising

  3. max wrote:

    > How to clear all html tag in line (or document) ?


    See FAQ.
     
    Brian McCauley, May 28, 2005
    #3
  4. * max schrieb:

    > How to clear all html tag in line (or document) ?
    > All tags have "<" on start, and ">" at the end of tag. Eg <table>, </table>,
    > <div align="left">, <td align="left" bgcolor="#000099"> ....
    > I make program that work character by character, and control if is start is
    > "<", and end ">".
    > Please help me I now those Perl programmers do that on easier way! How?


    I suggest to use the module HTML::Strip, it is doing exactly what you
    want. Have a look at

    http://search.cpan.org/~kilinrax/HTML-Strip-1.04/Strip.pm

    With that all you have to do is something like

    my $html = "<div><b>foo</b> bar</div> baz";
    my $text = HTML::Strip->new->parse( $html );
    print $text;
    __END__
    foo bar baz

    regards,
    fabian
     
    Fabian Pilkowski, May 28, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shruds
    Replies:
    1
    Views:
    881
    John C. Bollinger
    Jan 27, 2006
  2. Replies:
    1
    Views:
    402
    Andrew Thompson
    Nov 29, 2006
  3. David

    Response.Clear() doesn't clear

    David, Jan 31, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    1,071
    Mark Fitzpatrick
    Jan 31, 2008
  4. InvalidLastName

    Unrecognized element 'add' after <clear></clear>

    InvalidLastName, Feb 26, 2007, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    1,011
    Steven Cheng[MSFT]
    Mar 6, 2007
  5. Jim Ley
    Replies:
    3
    Views:
    217
Loading...

Share This Page