【发布时间】:2015-10-30 16:45:01
【问题描述】:
我在使用 {} 时遇到了一些问题。当我得到像 {1,8} 这样的最大值时,它不起作用,我现在不知道为什么。最小值有效
Private Sub Highlvl_Expression()
Dim strPattern As String: strPattern = "[a-zA-Z0-9_]{1,8}"
Dim strReplace As String: strReplace = ""
Dim regEx As New RegExp
Dim Test As Boolean
With regEx
.Global = True
.MultiLine = True
.IgnoreCase = False
.Pattern = strPattern
End With
Test = regEx.Test(Highlvl.Value)
If regEx.Test(Highlvl.Value) Then
MsgBox ("Validate")
Else
MsgBox ("Not Validate")
End If
End Sub
【问题讨论】:
-
使用锚点
Dim strPattern As String: strPattern = "^[a-zA-Z0-9_]{1,8}$"