开发者

Regular Expression working in .Net but not in Classic ASP

开发者 https://www.devze.com 2023-04-03 09:17 出处:网络
I have the below regular expression which is working fine in .NET however it is not working in Classic ASP. The Regular expression is used to validate for a least one digit and one character.

I have the below regular expression which is working fine in .NET however it is not working in Classic ASP. The Regular expression is used to validate for a least one digit and one character.

The expression is:

Set regPassword = New R开发者_开发百科egExp
regPassword.Pattern = "^(?=.*\d)(?=.*[A-Za-z]).{6,30}$"
Response.Write(regPassword.Test("Test456"))

The result of the above returns False.

Does anyone know a workaround for this?


 ^.(?=.*\d)(?=.*[A-Za-z]){6,30}

Here is a good resource on the VBScript Regex engine.

Edit: According to the comments, this works?

(.*[a-zA-Z].*[0-9]|.*[0-9].*[a-zA-Z])
0

精彩评论

暂无评论...
验证码 换一张
取 消