Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: strip html tags and special characters in perl while inserting the text in to database.

by graff (Chancellor)
on Jun 09, 2007 at 16:26 UTC ( #620198=note: print w/ replies, xml ) Need Help??


in reply to strip html tags and special characters in perl while inserting the text in to database.

You could try this:

$_ = "<p>text comes here </p><p>text within after in  attorney’s +fees,  Inc’s principle</p>"; s/<[^>]+>//g; s/[^[:ascii:]]+//g; print;
Have you read anything yet about perl regular expressions (perlretut and perlre)? You should -- the docs are really quite good.


Comment on Re: strip html tags and special characters in perl while inserting the text in to database.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2015-07-03 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (48 votes), past polls