asp 正则表达式检测http开头的函数
'函数:ishttp[str]
'参数:str,待处理的字符串
'作者:木木
'日期:2007/7/12
'描述:检测HTTP连接地址或地址栏是否以HTTP开头
'示例:<%=ishttp(http://www.alixixi.com)%>
'####################################
Function ishttp(str)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(http|HTTP)[A-Za-z]{0,1}://"
ishttp = regEx.Test(str)
End function
验证邮件地址是否符合标准
<%
'******************************
'函数:isemail(strng)
'参数:strng,待验证的邮件地址
'作者:阿里西西
'日期:2007/7/13
'描述:验证邮件地址是否符合标准
'示例:<%=isemail(ali@alixixi.com)%>
'******************************
Function isemail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
regEx.Pattern = "^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"
regEx.IgnoreCase = True
Set Match = regEx.Execute(strng)
if match.count then isemail= true
End Function
%>
正则表达式检测中国移动电话手机号码'*********************************************************
'函数:mobilecheck[str]
'参数:str,待处理的字符串
'作者:木木
'日期:2007/7/12
'描述:检测移动电话手机号码
'示例:<%=mobilecheck("13912345678")%>
'*********************************************************
Function mobilecheck(str)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(13[4-9]|15(8|9))d{8}$"
mobilecheck= regEx.Test(str)
End Function
javascript下正则匹配百分比的代码
scriptlanguage="javascript"varre=/^-?d+%$/;alert(re.test('50%'));alert(re.test('-25%'));alert(re.test('3a5%'));/script
javascript下一个还原html代码的正则
今天看到蓝色有人问这个问题,偶就试着写了一个,感觉正则的replace+function方式挺方便简洁,代码如下:[Ctrl+A全选注:如需引入外部Js需刷新才能执行]
JS正则表达式提取字符串中所有汉字的脚本
在网上发现有人用vbscript正则表达式实现了这个功能,但代码很厂,偶改成js的了,很短的一段代码:[Ctrl+A全选注:如需引入外部Js需刷新才能执行]这里