Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Strip HTML tags again

by Mask (Pilgrim)
on Jul 01, 2002 at 11:38 UTC ( [id://178517]=note: print w/replies, xml ) Need Help??


in reply to Strip HTML tags again

Hi monks, i am little bit disappointed in all this discussion.
If the input from chat is displayed in HTML page, then any "<" or ">" in the displayed text will be transformed to the &lt; and &gt; . So if you can see <this is a normal text> in your web browser, than in the sources of a HTML page it will be &lt;this is a normal text&gt; in this case you should not be bothered about knowing all tags, and if you want to see the text as it is in browser you need just to replace "&lt;" by "<" and "&gt;" by ">" in your perl code.

Replies are listed 'Best First'.
Re: Re: Strip HTML tags again
by dda (Friar) on Jul 01, 2002 at 12:49 UTC
    Ok, I'll try to explain. If someone types '<b>some text</b>', it should not be be displayed as a bold text in chat window, and displaying the HTML source is not a good idea too. I just have to strip all tags from the line.

    And '<some text>' should not be stripped. All regexp-based solutions will strip this too. I'm still looking for regexp-based stuff that will use %HTML::Tagset::isKnown hash to filter out only correct HTML tags.

    --dda

      look up the POD (or your preferred docs) for HTML::Tagset
      cite: "hashset %HTML::Tagset::isKnown
      This hashset lists all known HTML elements."
      So you've got to compare your match with that list ...

      Have a nice day
      All decision is left to your taste

      Addendum

      Look through the previous suggestions as well. Try it at least and ask again if you get an error or get otherwise stuck. :-)

        The problem is how to extract 'my match' from the regexp shown earlier (or other - please suggest one).. I know about that hashset, and what I need is to apply it to my sub.

        --dda

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://178517]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-18 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found