I have a question regarding a regular expression within Regex.Split() method which will help me to break each line of code into tokens.
I'm trying to parse some lines of C# source code and split them into tokens.
My logic is very simple: construct a regular expression with 'operators and punctuators' which will serve as delimiters and split a string into array of tokens including those delimiters.
For example:
I have the following line of C# code
Expand|Select|Wrap|Line Numbers
- public static void DoStuff ( string[] strArray, int someArgument )
Expand|Select|Wrap|Line Numbers
- public
- static
- void
- DoStuff
- (
- string
- [
- ]
- strArray
- ,
- int
- someArgument
- )
For example:
Expand|Select|Wrap|Line Numbers
- public /*should be private*/ static void DoStuff( string[] strArray ) //int someArgument )
Expand|Select|Wrap|Line Numbers
- public
- /*should be private*/
- static
- void
- DoStuff
- (
- string
- [
- ]
- strArray
- )
- //int someArgument )
Many thanks in advance.