检查UCase(RegEx)的输入,如果LCase

时间:2016-08-06 20:02:16

标签: regex hta

我有以下脚本:

Function IsValidLetter( Letter )

const IVNAME_TEST = "[A-Z]{1,2}"
Dim regEx, match, myMatches
Set regEx = New RegExp
regEx.Pattern = IVNAME_TEST
regex.IgnoreCase = false

Set myMatches = regEx.Execute( UCase(Letter) )
If myMatches.Count > 0 Then
    IsValidLetter = true
End If
End function

效果很好,因为我想在输入字段中输出A-Z最多2个字母。我的问题;如何检查输入是低位还是大写?最好的解决方案是,如果它在飞行中转换它'有了这个功能。

PS:' Letter'是HTML文件的输入值。

更新

Sub SetFullName
    UppercaseConvert.Value = Letter.Value
    CombinedName.Value = Ucase(CombinedName.Value)
End Sub

效果很好! :)

1 个答案:

答案 0 :(得分:0)

或者你可以:

  1. 设置regex.IgnoreCase = true
    1. 设置IVNAME_TEST = "[A-Za-z]{1,2}"