Hi, I am new to regular expressions. I am looking through .cs files to try and find a pattern. I am trying to find all instances of returning a variable that might be created on the local stack: my function { variable = something; ... return variable } I don't
want to use C# or any language. I want to find all occurences using just a regular expression. I have not found any examples of using the variable inside the regular expression. All the examples show the code getting the value of the variable. I don't want
that. Can you help me?
I assume it would be easier to make a search for all returns with a grouping reference given to their function. After they're all found, turn around and and search the function for a declaration of the var (noting of course inheritance and interface implementations).
This can be extremely tricky for many reasons. Namely you might have something like this:
christine_ir...
Member
15 Points
3 Posts
using variables inside of a regular expression
Jul 29, 2004 02:48 PM|LINK
pickyh3d
Star
9696 Points
1955 Posts
Re: using variables inside of a regular expression
Sep 27, 2004 02:51 AM|LINK
string fubar ( ) { string strTemp = "xwz"; return strTemp.Replace("w", "y"); }Do you count that? Technically, you're returning something else (new memory location when dealing with a string manipulation).