Reputation:
Given stack trace generated by a .NET program how would I extract all method names appearing in the stack trace.
For example:
Unhandled Exception: System.NotImplementedException: The method or operation is not implemented. at WindowsApplication1.Program.Baz() at WindowsApplication1.Program.Foo() at WindowsApplication1.Program.Bar() at WindowsApplication1.Program.Main()
The output should be:
WindowsApplication1.Program.Baz WindowsApplication1.Program.Foo WindowsApplication1.Program.Bar WindowsApplication1.Program.Main
Upvotes: 0
Views: 58
Reputation: 2940
[\w.]+(?=\(\))
Use this regular expressiong should do what you want perfectly
Upvotes: 1
Reputation: 1
Use this regular expression: (?<name>[\w|\.|=|`]+)(?=\()
Per each stack frame it will match all characters appearing before the first parenthesis in each line
Upvotes: -1
Reputation: 13631
The following will match any sequence of non-space characters that is followed by ()
\S+(?=\(\))
Upvotes: 1