RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Strip HTML tags and content between
Expression
<(script|style)[^>]*?>(?:.|\n)*?</\s*\1\s*>
Description
This regular expression will match only <script> and <style> tags and all content between them. Use this with regex.replace to strip script blocks and style blocks from HTML source.
Matches
<script>test</script>, <style>test<style>
Non-Matches
-all other html code is ignored-
Author Rating: The rating for this expression. Charles Forsyth
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: eef
Name: erere
Date: 11/23/2010 2:16:59 PM
Comment:
rere


Title: The best one I have found!
Name: Brien
Date: 10/29/2008 6:06:14 PM
Comment:
EXCELENT! Only RegExp that I have found that actually matches all script tags in a page. I have looked through many, but the rest seem to fail. Thank you SO much for adding this


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials