Posted By

rengber on 01/16/07


Tagged

csharp RegularExpression SourceCodeAnalysis


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

copyleft
enajenkins
Tyster
danfinrud55


Regular Expression to Grab a ClassName from a C# Code File


 / Published in: Regular Expression
 

URL: http://aspnet.4guysfromrolla.com/articles/022603-1.aspx

The expression inside the parenthesis indicates a positive lookbehind. It will match any occurance of the literal "class". The two slash s's represent an occurance of spaces following class and then any non space characters. These capture the name of the class.

  1. (?<=class\s)\s*\S*

Report this snippet  

You need to login to post a comment.