本文章为你提供一款超好的asp教程 去除字符串中的空格和数字正则表达式哦,这四款替换空格与数字的正则是各有不同哦。
方法二
方法三
function checkexp(patrn, strng)
dim regex, match ’ 建立变量。
set regex = new regexp ’ 建立正则表达式。
regex.pattern = patrn ’ 设置模式。
regex.ignorecase = true ’ 设置是否区分域名交易字符大小写。
regex.global = true ’ 设置全局可用性。
matches = regex.test(strng) ’ 执行搜索。
checkexp = matches
end function
方法四
s
t
r
=
′
h
t
t
p
:
/
/
w
w
w
.
111
c
n
.
n
e
t
/
h
t
t
p
:
/
/
w
w
w
.
a
a
.
c
o
m
/
a
.
j
p
g
′
;
/
/
str = 'http://www.111cn.net/ http://www.aa.com/a.jpg'; //
str=′http://www.111cn.net/http://www.aa.com/a.jpg′;//part = ‘|(http://[a-za-z0-9/?&.]*)|si’;
p
a
r
t
2
=
′
∣
(
h
t
t
p
[
s
]
?
:
/
/
)
?
s
∗
w
.
(
?
!
(
j
p
g
∣
g
i
f
∣
p
n
g
)
)
w
∗
∣
s
i
′
;
p
r
e
g
m
a
t
c
h
a
l
l
(
part2 = '|(http[s]?://)?s*w.(?!(jpg|gif|png))w*|si'; preg_match_all(
part2=′∣(http[s]?://)?s∗w.(?!(jpg∣gif∣png))w∗∣si′;pregmatchall(part2,
s
t
r
,
str,
str,str);
var_dump($str);