Function 取汉字(txt, Optional L = 1)
Set reg = CreateObject("VBScript.RegExp")
pt = Choose(L, "\w", "[^a-zA-Z]", "\D", "[^a-z]", "[^A-Z]", "\W")
With reg
.Global = True
.Pattern = pt
取汉字 = .Replace(txt, "")
End With
End Function
Function 取英字(txt, Optional L = 2)
Set reg = CreateObject("VBScript.RegExp")
pt = Choose(L, "\w", "[^a-zA-Z]", "\D", "[^a-z]", "[^A-Z]", "\W")
With reg
.Global = True
.Pattern = pt
取英字 = .Replace(txt, "")
End With
End Function
Function 取数字(txt, Optional L = 3)
Set reg = CreateObject("VBScript.RegExp")
pt = Choose(L, "\w", "[^a-zA-Z]", "\D", "[^a-z]", "[^A-Z]", "\W")
With reg
.Global = True
.Pattern = pt
取数字 = .Replace(txt, "")
End With
End Function
Function 取小写英字(txt, Optional L = 4)
Set reg = CreateObject("VBScript.RegExp")
pt = Choose(L, "\w", "[^a-zA-Z]", "\D", "[^a-z]", "[^A-Z]", "\W")
With reg
.Global = True
.Pattern = pt
取小写英字 = .Replace(txt, "")
End With
End Function
Function 取大写英字(txt, Optional L = 5)
Set reg = CreateObject("VBScript.RegExp")
pt = Choose(L, "\w", "[^a-zA-Z]", "\D", "[^a-z]", "[^A-Z]", "\W")
With reg
.Global = True
.Pattern = pt
取大写英字 = .Replace(txt, "")
End With
End Function
Function 取英数字(txt, Optional L = 6)
Set reg = CreateObject("VBScript.RegExp")
pt = Choose(L, "\w", "[^a-zA-Z]", "\D", "[^a-z]", "[^A-Z]", "\W")
With reg
.Global = True
.Pattern = pt
取英数字 = .Replace(txt, "")
End With
End Function