JS的正则表达式 //校验是否全由数字组成 function isDigit(s) { var patrn=/^[0-9]{1,20}$/; if (!patrn.exec(s)) return false return true } //校验登录名:只能输入5-20个以字母开头、可带数字、“_”、“.”的字串 function isRegisterUserName(s) { var patrn=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/; if (!patrn.exec(s)) return false return true } //校验用户姓...[ 查看全文 ]
代码例子如下: % Option Explicit Function stripHTML(strHTML) 'Strips the HTML tags from strHTML Dim objRegExp, strOutput Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = ".+?" 'Replace all HTML tag matches with the empty string strOutput = objRegExp.Replace(strHTML, "") 'Replace all and with and strOutput = R...[ 查看全文 ]
$str = '中华人民共和国123456789abcdefg'; echo preg_match("/^[\u4e00-\u9fa5_a-zA-Z0-9]{3,15}$",$strName); 运行一下上面这段代码,看会有什么提示信息? Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in F:\wwwroot\php\test.php on line 2 原来,PHP正则表达式中不支持下列 Perl 转义序列:\L, \l, \N, \P, \p, \U, \u, or ...[ 查看全文 ]
一、清楚内容中的Javsscript 代码 代码如下: Function ClearJSCode(originCode) Dim reg set reg = New RegExp reg.Pattern = "SCRIPT[^]*/SCRIPT" reg.IgnoreCase = True reg.Global = True clearJSCode = reg.Replace(originCode, "") End Function 二、清除内容中的HTML代码 代码如下: Function ClearHTMLCode(originCode) Dim reg set reg = new RegExp reg.Pattern = "[^]*" ...[ 查看全文 ]