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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(?s)/\*.*\*/
Description
Matches
/* .................... */ | /* imagine lots of lines here */
Non-Matches
*/ malformed opening tag */ | /* malformed closing tag /*
Author Rating: Not yet rated. Darren Neimke
Source Tester
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: This should be changed to be non-greedy
Name: Adam M.
Date: 3/17/2005 8:15:22 PM
Comment:
Using .* in the center of that is greedy, so the expression with match too much. For instance, it will match this entire string, including the "NOT COMMENT" text: /* comment */ NOT COMMENT /* comment2 */ You can use .*? instead of .* to make it non-greedy, so it'll match the two comments but not the other text in the center.


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