Ver código fonte

修复字符串异常导致正规比较异常的Bug.

jianfeng1.wang 2 anos atrás
pai
commit
681d093df5
1 arquivos alterados com 12 adições e 2 exclusões
  1. 12 2
      FactoryTool_CShare/Business/CommonMethod.cs

+ 12 - 2
FactoryTool_CShare/Business/CommonMethod.cs

@@ -1256,8 +1256,18 @@ end:
         {
         {
             if (value is null)
             if (value is null)
                 return false;
                 return false;
-            Regex r = new Regex(@"^[a-zA-Z0-9]+$");
-            return r.Match(value).Success;
+
+            try
+            {
+                Regex r = new Regex(@"^[a-zA-Z0-9]+$");
+                return r.Match(value).Success;
+            }
+            catch(Exception ex)
+            {
+                Log.WriteErrorLog(string.Format("Regex Match Error. {0} -> {1} ", value, ex.Message));
+            }
+
+            return false;
         }
         }
 
 
         public static bool InsertJsonConfig(string node, string key, bool value = false)
         public static bool InsertJsonConfig(string node, string key, bool value = false)