ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RegEx Check password string (https://www.excelbanter.com/excel-programming/352407-re-regex-check-password-string.html)

Tim Williams

RegEx Check password string
 
Also maybe just try [A-Za-z0-9]{7,15}

Tim


"Tim Williams" <saxifrax at pacbell dot net wrote in message
...
EM,

Any reason you're testing the range's Formula instead of the Value ?

Tim

"ExcelMonkey" wrote in message
...
Can someone tell me why this is not working. I am trying to test a
string to
see if it has a combination of letters and numbers from 7-15 characters
long.

Thanks

Public Function CheckPassword(rng As Range) As Variant
Dim reg As Object
'Checks for password with
Set reg = CreateObject("VBScript.RegExp")
With reg
.Pattern = "^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{7,15}$"
CheckPassword = .test(rng.Formula)
End With
End Function







All times are GMT +1. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com