I have some simple code that checks a string for lowercase charatcers. I then want to know how many lowercase characters exist. Later in the code I also check for other regulkar expression filters such as uppercase, numbers, and special characters. For simplicity, I am only showing lowercase.
Const PASSWORD_LOWERCASE_FILTER = "[a-z]"
Dim strString
Dim objRegExp
strString = "aaaabbbbAAAABBBB"
Set objRegExp = New RegExp
objRegExp.Pattern = PASSWORD_LOWERCASE_FILTER
objRegExp.IgnoreCase = False
objRegExp.Global = False
Set expressionmatch = objRegExp.Execute(strString)
if expressionmatch.Count => 2 then
msgbox(expressionmatch.Count)
end if
No matter what that string is, expressionmatch.Count is always equal to either 0 or 1, which doesn't make sense. I expected it to equal 8, since there are 4 lowercase a's and 4 lowercase b's. Any ideas?
Note: I do know a workaround, which is to use:
dim count
for each match in expressionmatch
count = count + 1
But if .count is supposed to work (which according to documentation, it is) I want to find out why it doesn't here
Const PASSWORD_LOWERCASE_FILTER = "[a-z]"
Dim strString
Dim objRegExp
strString = "aaaabbbbAAAABBBB"
Set objRegExp = New RegExp
objRegExp.Pattern = PASSWORD_LOWERCASE_FILTER
objRegExp.IgnoreCase = False
objRegExp.Global = False
Set expressionmatch = objRegExp.Execute(strString)
if expressionmatch.Count => 2 then
msgbox(expressionmatch.Count)
end if
No matter what that string is, expressionmatch.Count is always equal to either 0 or 1, which doesn't make sense. I expected it to equal 8, since there are 4 lowercase a's and 4 lowercase b's. Any ideas?
Note: I do know a workaround, which is to use:
dim count
for each match in expressionmatch
count = count + 1
But if .count is supposed to work (which according to documentation, it is) I want to find out why it doesn't here