28,391
社区成员
发帖
与我相关
我的任务
分享
str="<p> <font>aaaaaa </font><font>bbbb </font> </p>"
Set objRegExp=New RegExp
Set Reg=New RegExp
objRegExp.IgnoreCase=true
objRegExp.Global=true
objRegExp.Pattern="(<[^>\/]*>)([^<]+)(<\/[^>]+>)"
Reg.IgnoreCase=false
Reg.Global=false
set Matches=objRegExp.Execute(str)
set objRegExp=nothing
num=7'设定截取7个数字
if Matches.Count<>0 then
For Each Match in Matches
if num>0 then
Reg.Pattern="(<[^>\/]*>)"&Match.SubMatches(1)&"(<\/[^>]+>)"
str=Reg.replace(str,"$1"&left(Match.SubMatches(1),num)&"$2")
num=num-len(trim(Match.SubMatches(1)))
response.Write num
end if
next
end if
set Reg=nothing
response.Write str
str="<p> <font>aaaaaa </font><font>bbbb </font> </p>"
Set objRegExp=New RegExp
Set Reg=New RegExp
objRegExp.IgnoreCase=true
objRegExp.Global=true
objRegExp.Pattern="(<[^>\/]*>)([^<]+)(<\/[^>]+>)"
Reg.IgnoreCase=false
Reg.Global=false
set Matches=objRegExp.Execute(str)
set objRegExp=nothing
if Matches.Count<>0 then
For Each Match in Matches
Reg.Pattern="(<[^>\/]*>)"&Match.SubMatches(1)&"(<\/[^>]+>)"
str=Reg.replace(str,"$1"&left(Match.SubMatches(1),2)&"$2")
next
end if
set Reg=nothing
response.Write str
str="<p> <font>aaaaaa </font><font>bbbb </font> </p>"
Set objRegExp=New RegExp
Set Reg=New RegExp
objRegExp.IgnoreCase=true
objRegExp.Global=true
objRegExp.Pattern="(<[^>\/]*>)([^<]+)(<\/[^>]+>)"
Reg.IgnoreCase=false
Reg.Global=false
set Matches=objRegExp.Execute(str)
set objRegExp=nothing
if Matches.Count<>0 then
For Each Match in Matches
Reg.Pattern="(<[^>\/]*>)"&Match.SubMatches(1)&"(<\/[^>]+>)"
str=Reg.replace(str,"$1"&left(Match.SubMatches(1),2)&"$2")
next
end if
set Reg=nothing
response.Write str
str="<p> <font>aaaaaa </font> </p>"
Set objRegExp=New RegExp
objRegExp.IgnoreCase=true
objRegExp.Global=true
objRegExp.Pattern="(<[^>\/]*>)([^<]+)(<\/[^>]+>)"
set Matches=objRegExp.Execute(str)
if Matches.Count<>0 then
str1=left(Matches(0).SubMatches(1),2)&"<br>"
end if
response.Write objRegExp.replace(str,"$1"&str1&"$3")
str="<p> <font>aaaaaa </font> </p>"
Set objRegExp=New RegExp
objRegExp.IgnoreCase=true
objRegExp.Global=true
objRegExp.Pattern="(<[^>\/]*>)([^<]+)(<\/[^>]+>)"
set Matches=objRegExp.Execute(str)
if Matches.Count<>0 then
str1=left(Matches(0).SubMatches(1),2)&"<br>"
end if
response.Write objRegExp.replace(str,"$1"&str1&"$3")