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
This pattern will match any multi-line or single line comments in TSQL (Stored Procedures or SPROC's) in MS SQL Server.
Matches
/* My Comment */ | -- A single line comment
Non-Matches
*/ Won't work /* | // Not likely | - uh uh
Author Rating: The rating for this expression. Todd Davis
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: Comment comment
Name: Eton
Date: 11/6/2006 11:56:18 AM
Comment:
Pretty good but I'm lookingfor one that won't return a false positive when searching javascript source on a statement such as this: if(!str.match(/^\[tr\]/i)){str=str.replace(/\[\/*?tr\]/g,"\u00AE");} My own construct /(?!\\)(\/\*(?:\w|\W)*?\*\/)/gim for some reason won't work. The lookahead apparently needs a character in front of it in order to work (although .net is perfectly happy to return results in RETester). I need to find another way to ignore escaped comment delimiters without including it in the match.


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