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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find remove HTML comments from html page
Expression
(\<!--\s*.*?((--\>)|$))
Description
matches comments <!-- --> in string. Singleline option must be enabled. It works well also with multiple comment start tags such as: <!--this is comment <!--and this as well and end-- of comment is!-- >right now-->. It also matches comments in between script or style tags <script> <!-- --> </script>
Matches
<!-- comment <!-- continuing -- >and ends now-->
Non-Matches
< !-- not comment -->, <a href="--">, all other html code
Author Rating: Not yet rated. David Havl
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

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