关于判断正则的问题,快来帮下!

chong6 2009-09-01 01:20:58
这个代码应该如何写哦?
我要弄判断当有包含数字就显示有包含数字,没有就没有!
正确应该如何写?

<%
str="6565656"

if RegExpfind("[\da-z]*", str) then
Response.write "有包含数字"
else
Response.write "没有包含数字"
end if
%>
...全文
63 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2009-09-01
  • 打赏
  • 举报
回复

<%
str="6565656"

if RegExpfind("[\d]+", str) then
Response.write "有包含数字"
else
Response.write "没有包含数字"
end if

Function RegExpfind(p, s)
Dim re
Set re = New RegExp
re.Pattern = p
re.Global = True
RegExpfind = re.Test(s)
End Function

%>
gw6328 2009-09-01
  • 打赏
  • 举报
回复
[\d+]看这个行不行
chong6 2009-09-01
  • 打赏
  • 举报
回复
能给下具体代码吗?
帮改下~~~不要单独给一点,我怕我套错~
Atai-Lu 2009-09-01
  • 打赏
  • 举报
回复

'//--正则检测--//
Function isMach(str,reg)
if isnull(str) or str="" then isMach=false:exit function
Set regEx = New RegExp
regEx.Pattern = reg
regEx.IgnoreCase = true
regEx.Global = true
isMach = regEx.test(str)
Set reg=nothing
End Function
if isMach("sdfd333", "\d+") then
Response.write "有包含数字"
else
Response.write "没有包含数字"
end if

Atai-Lu 2009-09-01
  • 打赏
  • 举报
回复
正则:\d+

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧