Changed drawing regex to static

This commit is contained in:
AJ
2019-11-24 19:54:24 -05:00
parent 222431190b
commit b207d4c319

View File

@@ -4,6 +4,8 @@ namespace ExportDXF
{ {
public class DrawingInfo public class DrawingInfo
{ {
private static Regex drawingFormatRegex = new Regex(@"(?<jobNo>[34]\d{3}(-\d+\w{1,2})?)\s?(?<dwgNo>[ABEP]\d+(-?(\d+|[A-Z]))?)", RegexOptions.IgnoreCase);
public string JobNo { get; set; } public string JobNo { get; set; }
public string DrawingNo { get; set; } public string DrawingNo { get; set; }
@@ -30,9 +32,7 @@ namespace ExportDXF
public static DrawingInfo Parse(string input) public static DrawingInfo Parse(string input)
{ {
const string pattern = @"(?<jobNo>[34]\d{3}(-\d+\w{1,2})?)\s?(?<dwgNo>[ABEP]\d+(-?(\d+|[A-Z]))?)"; var match = drawingFormatRegex.Match(input);
var match = Regex.Match(input, pattern);
if (match.Success == false) if (match.Success == false)
return null; return null;