asp如何限制定义变量求教!!高手帮忙啊!

来源:百度知道 编辑:UC知道 时间:2024/05/15 03:16:55
要求是:前4位必须是huhu
if request.form("code")="huhu后面是任意的11位数字" then
开始执行语句

那位高手帮我写huhu后面怎样限制啊!先谢了

用正则判断 ...

/^[0-9]{11}$/

code = request.form("code")
if len(code)=15 and left(code,4)="huhu" then
code1= Replace(code,"huhu","")
if len(code1)=11 and isnumeric(code1) then
Response.write "ok"
else
Response.write "HUHU后面必须是11位的数字"
end if
else
Response.write "必须是huhu开头, 后跟11位数字"
end if

----------
正则应该这样写:
/^huhu[0-9]{11}$/

在获得值的时候写上
"huhu" & "你要传的值"