# RegExLib.com - The first Regular Expression Library on the Web!

## Regular Expression Details

Title Test Find Pattern Title (at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)($$)(?<parameters>[^$$]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))? Just a simple regExp to parse the stack trace. Developed when using the exception block from MS, coz they only showed the stack all bunched together. Could be used as follows: [C#] string regExParams = @"(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)($$)(?<parameters>[^$$]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))?"; Regex re = new System.Text.RegularExpressions.Regex(regExParams,RegexOptions.Compiled); MatchCollection mtc; mtc = re.Matches(System.Environment.StackTrace); foreach(Match mt in mtc) { MessageBox.Show(mt.Result("${fullClassName}")); MessageBox.Show(mt.Result("${methodName}")); MessageBox.Show(mt.Result("${parameters}")); MessageBox.Show(mt.Result("${fileName}")); MessageBox.Show(mt.Result("\${lineNumber}")); } Seems to work well, but use at your own peril!! Feel free to use and enhance (there's probably a lot that could be done, like getting parameters individually(?), etc) at System.IO.__Error.WinIOError(Int32 errorCode, String str) | at ExceptionManagementQuickStartSampl ExceptionManagementQuickStartSamples.Form1.DoLogon(String userName, String password) in c:\program f Rating: Not yet rated. Mike Stancombe me Bad 1 2 3 4 5 Good

## Enter New Comment

 Title   Name   Comment   Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):