» » Commonly used tags regex for PHP filter

 

Commonly used tags regex for PHP filter

Author: bamboo06 on 5-11-2014, 02:20, views: 3441

10
Commonly used tags regex for PHP filter

In php projects, often use to label some filtering regular expressions, collections for spare:
$str=preg_replace("/\s+/", " ", $str); //Filter redundant Enter
$str=preg_replace("/<[ ]+/si","<",$str); //Filter <__(after "<" there is space)
$str=preg_replace("/<\!–.*?–>/si","",$str); //Note
$str=preg_replace("/<(\!.*?)>/si","",$str); //Filter DOCTYPE
$str=preg_replace("/<(\/?html.*?)>/si","",$str); //Filter html tag
$str=preg_replace("/<(\/?head.*?)>/si","",$str); //Filter head tag
$str=preg_replace("/<(\/?meta.*?)>/si","",$str); //Filter meta tag
$str=preg_replace("/<(\/?body.*?)>/si","",$str); //Filter body tag
$str=preg_replace("/<(\/?link.*?)>/si","",$str); //Filter link tag
$str=preg_replace("/<(\/?form.*?)>/si","",$str); //Filter form tag
$str=preg_replace("/cookie/si","COOKIE",$str); //Filter COOKIE tag
$str=preg_replace("/<(applet.*?)>(.*?)<(\/applet.*?)>/si","",$str); //Filter applet tag
$str=preg_replace("/<(\/?applet.*?)>/si","",$str); //Filter applet tag
$str=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$str); //Filter style tag
$str=preg_replace("/<(\/?style.*?)>/si","",$str); //Filter style tag
$str=preg_replace("/<(title.*?)>(.*?)<(\/title.*?)>/si","",$str); //Filter title tag
$str=preg_replace("/<(\/?title.*?)>/si","",$str); //Filter title tag
$str=preg_replace("/<(object.*?)>(.*?)<(\/object.*?)>/si","",$str); //Filter object tag
$str=preg_replace("/<(\/?objec.*?)>/si","",$str); //Filter object tag
$str=preg_replace("/<(noframes.*?)>(.*?)<(\/noframes.*?)>/si","",$str); //Filter noframes tag
$str=preg_replace("/<(\/?noframes.*?)>/si","",$str); //Filter noframes tag
$str=preg_replace("/<(i?frame.*?)>(.*?)<(\/i?frame.*?)>/si","",$str); //Filter frame tag
$str=preg_replace("/<(\/?i?frame.*?)>/si","",$str); //Filter frame tag
$str=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$str); //Filter script tag
$str=preg_replace("/<(\/?script.*?)>/si","",$str); //Filter script tag
$str=preg_replace("/javascript/si","javascript",$str); //Filter script tag
$str=preg_replace("/vbscript/si","Vbscript",$str); //Filter script tag
$str=preg_replace("/on([a-z]+)\s*=/si","On\\1=",$str); //Filter script tag
$str=preg_replace("/&#/si","&#",$str); //Filter script tag

Category: PHP Scripts

Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.
<
  • 0 Comments
  • 0 Articles
10 November 2017 23:03

Harry

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
It's a very informative code. I would like to learn more and write something for <a href="https://sites.google.com/view/easyessays/">https://sites.goog
le.com/view/easyessays/</a> about it. Thank you for your help.

<
  • 0 Comments
  • 0 Articles
2 January 2018 21:11

Jonathon Valencia

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Is it just me or the RedEx logo looks much similar to that of FedEx. I was only just going through the best essay review which honestly helped me out. The coding and all have become much less complicated now when compared to earlier before.

<
  • 0 Comments
  • 0 Articles
16 January 2018 21:43

Aabriella

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Taking a look at any specific web log could make many others really require to generate more. Used to do a fun packed that we was initially fabulous subject matter by. Animoto likely held in the collection always it’s great. As i commonly dispatch one. Darel L Long

<
  • 0 Comments
  • 0 Articles
16 January 2018 23:10

Alex

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
The look favorably fantastic. Many of these small data tend to be designed making use of lots of background encounter. I'd like everything considerably. putlocker movies

<
  • 0 Comments
  • 0 Articles
21 January 2018 22:37

Samme

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
This unique looks utterly perfect. Every one of plain and simple records are prepared through the help of great number for working experience handy experience. I will be happy it all for a second time considerably.genbrugsbutik møbler

<
  • 0 Comments
  • 0 Articles
23 January 2018 17:54

Jack

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Such type of sounds definitely top. Every one of these smaller knowledge really are crafted alongside several foundation knowledge. I favor which usually very much. Brave Browser

<
  • 0 Comments
  • 0 Articles
25 January 2018 23:58

James

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
House clearance London provided by We Clear Everything. First rate house clearance in London and office clearance service in London. Book We Clear Everything and enjoy your free space at home in London. office clearance London

<
  • 0 Comments
  • 0 Articles
30 January 2018 18:33

Amir

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
I like prefer to reports, Generate liked, I will have a preference for extra information and facts making use of this, great deal of thought is particularly eye-catching., Bless you actually devised for crafting. website design agency

<
  • 0 Comments
  • 0 Articles
31 January 2018 19:31

Aalin

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
That i don’t fully understand once you discover any severity for assistance that personal blogs supply. In my opinion, I do know that this it all weren’t in your personal blogs We'd don't have uncovered that will help utilizing my best essays. http://www.lenceinte-bluetooth.fr

<
  • 0 Comments
  • 0 Articles
3 February 2018 00:00

JAck

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
I favor all the lot of pieces, Wondered certainly cherished, You want advise. in this particular, pondering that should be a bit first rate., Bless you plenty when considering demonstrating to.معروف ترین وکیل تهران

Information
Comment on the news site is possible only within (days) days from the date of publication.