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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(?:/\*[\w\W]*?\*/|//[^\n]*?$|\#[^\n]*?$)
Description
Return all comment lines (starts with //) and regions (serounded by /* */) as well as compiler arguments (#) in C# code
Matches
// some comment | #region myRegion | /* other comment */
Non-Matches
for(int i = 0; i < 10; i++) | [XmlAttribute("somthing_else") | String name = "MyNa
Author Rating: Not yet rated. Ittayy Ophir
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: Incorrectly matches "text /* stuff" more things "text */ stuff"
Name: Randal L. Schwartz
Date: 12/18/2005 9:30:06 PM
Comment:
Once again, a regex that should be replaced by a proper lexer. This regex doesn't note whether or not the start-end tags are inside double-quoted strings or other syntactic elements.


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