Index: src/Common/DelftTools.Utils/RegularExpressions/RegularExpression.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/DelftTools.Utils/RegularExpressions/RegularExpression.cs (.../RegularExpression.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/DelftTools.Utils/RegularExpressions/RegularExpression.cs (.../RegularExpression.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -21,15 +21,15 @@ public const string EndOfLine = @"\s*($|(\n|\r\n?))"; + // can be a memory leak, clear it regularly + private static readonly IDictionary expressions = new Dictionary(); + public static Match GetFirstMatch(string pattern, string sourceText) { var matches = GetMatches(pattern, sourceText); return matches.OfType().FirstOrDefault(); } - // can be a memory leak, clear it regularly - private static readonly IDictionary expressions = new Dictionary(); - public static void ClearExpressionsCache() { expressions.Clear(); @@ -114,7 +114,7 @@ var matches = GetMatches(GetCharacters(field), record); return matches.Count > 0 ? matches[0].Groups[field].Value : ""; } - + public static string ParseFieldAsIntegerOrString(string field, string record) { var match = GetFirstMatch(GetInteger(field), record); @@ -157,7 +157,6 @@ return match.Groups[field].Success ? ConversionHelper.ToDouble(match.Groups[field].Value) : defaultValue; } - /// /// Retrieves a float value if it is available in the math. /// example: @@ -186,4 +185,4 @@ return match.Groups[field].Success ? match.Groups[field].Value : defaultValue; } } -} +} \ No newline at end of file