Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detect html/javascript/php tags in string

Status
Not open for further replies.

piti

Technical User
Apr 12, 2001
627
SK
hi

i'm having problems with one user who started inserting weird pieces of code (html, javascript and php) into my messageboard
i had there the strip_tags() function, but the string was inserted not tag stripped :-(
does anyone have a regexp that detects all that html, php and javascript tags?
thanx
 
hi

i started to experiment and this came out:

preg_match('/<([a-z]+)[^>]*>.+<\/([a-z]+)[^>]*>|<(\?|%|([a-z]+)[^>]*).*(\?|%|)>/is',$text)

this detects all of them ( and something more ;-) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top