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

/ Published in: Regular Expression
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  1. (?<=class\s)\s*\S*


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.