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 |
|
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.