验证guid()类型值的函数

验证guid()类型值的函数

Function IsGUID(expression)

'********************************************
'函数名:IsGUID
'作  用:检查guid()合法性
'参  数:expression ----要检查的guid()
'返回值:True  ----guid()合法
'       False ----guid()不合法
'********************************************


    if not(IsNull(expression)) then
        Set guidRegEx = new Regexp
  guidRegEx.Pattern ="^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$"
        IsGUID=guidRegEx.Test(expression)
    else
        IsGUID=false
    end if
end Function

companyid="{3767F96B-8AEC-4E29-B416-22A1060A2C58}"
jieguo=IsGUID(companyid)


 

原文地址:https://www.cnblogs.com/ly312/p/1897511.html