Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 cooling their heels in the Monastery: (5)
As of 2016-08-31 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (437 votes). Check out past polls.