I need to test a string to see if it is a hex value, but I'm running into some problems. Here's what I have so far:
strTest = Request("t"
Set regEx = New RegExp
regEx.IgnoreCase = False
regEx.Pattern = "[^0-9A-F]+\s"
If Not regEx.test(strTest) and Len(strTest) MOD 2 = 0 Then isHex = true Else isHex = false
I know in this case the hex will always be uppercase, so that's why I'm ignoring case. I tried to setup a match for anything other than a number or letters A-Z, or a whitespace. When I run tests on it both "4E2B7F0A" and "4E B7F0A" return true. The space should make it return false. Lower case "4e2b7f0a" should also return false. Any ideas on my error?
Thanks,
Mike
strTest = Request("t"
Set regEx = New RegExp
regEx.IgnoreCase = False
regEx.Pattern = "[^0-9A-F]+\s"
If Not regEx.test(strTest) and Len(strTest) MOD 2 = 0 Then isHex = true Else isHex = false
I know in this case the hex will always be uppercase, so that's why I'm ignoring case. I tried to setup a match for anything other than a number or letters A-Z, or a whitespace. When I run tests on it both "4E2B7F0A" and "4E B7F0A" return true. The space should make it return false. Lower case "4e2b7f0a" should also return false. Any ideas on my error?
Thanks,
Mike