Return to Snippet

Revision: 2244
at January 22, 2007 12:43 by rengber


Initial Code
(?<=new\s)\s*\S*?\s*(?=[\[\(])

Initial URL
http://docs.python.org/lib/re-syntax.html

Initial Description
The first part enclosed in parens is a lookbehind matching the word "new" followed by a space.   Next is a block matching any non white space characters bordered by zero or more spaces.   Last is a lookahead block matching zero or more square brackets or parens.  This excludes things like arrays and constructor parameters from the return.   (for example, "new string[5]" will just return "string".

Initial Title
Regular Expression to Grab an Object Type Name from a C# Code File.

Initial Tags

                                

Initial Language
Regular Expression