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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find C# Methods
Expression
(private|public|protected)\s\w(.)*\((.)*\)[^;]
Description
Finds all public or private C# methods with a return type, with or without parameters. Excludes private and public members which may look like a method. Private and public members that can be confused with methods typically have a semicolon after the closing parentheses. NOTE: Visual Studio uses a non-standard regular expression syntax for Find and Replace. The eqivalent pattern is: (private|public|protected):b:w(.)*\((.)*\)$
Matches
public void SQLSelect(Form fo)
Non-Matches
private G G = new G();
Author Rating: The rating for this expression. Robert S. Robbins
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: Some problems with this one... it seems
Name: Yoann
Date: 9/4/2008 5:10:54 AM
Comment:
Hi ! I think there are some issues with this regexp : - methods that only starts with "void" on a return type, may not be found, - internal methods may not be found, - "public class xxx" is found... ++


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