简体   繁体   English

正则表达式可以在.Net中运行,但不能在经典ASP中运行

[英]Regular Expression working in .Net but not in Classic ASP

I have the below regular expression which is working fine in .NET however it is not working in Classic ASP. 我有下面的正则表达式,它在.NET中工作正常,但是在Classic ASP中不工作。 The Regular expression is used to validate for a least one digit and one character. 正则表达式用于验证至少一位数字和一个字符。

The expression is: 表达式是:

Set regPassword = New RegExp
regPassword.Pattern = "^(?=.*\d)(?=.*[A-Za-z]).{6,30}$"
Response.Write(regPassword.Test("Test456"))

The result of the above returns False. 上面的结果返回False。

Does anyone know a workaround for this? 有谁知道解决方法?

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

Here is a good resource on the VBScript Regex engine. 这是VBScript Regex引擎的一个很好的资源。

Edit: According to the comments, this works? 编辑:根据评论,这行得通吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM