There is a segment string: asdfasdlfajsodf{#kljlkkm#}ojgvjfkdsf{#wdfs#}llsdflksdf
There is no rule... I want to find out the {#kljlkkm#} and {#wdfs#} inside...
1. Split method:
The code copy is as follows:
<%
DimI,sCode,aCode,sNewCode
sCode="asdfasdlfajsodf{#kljlkkm#}ojgvjfkdsf{#wdfs#}llsdflksdf"
aCode=Split(sCode,"{#")
sNewCode=""
ForI=0ToUBound(aCode)
IfInStr(aCode(I),"#}")>0ThensNewCode=sNewCode&"{#"&Split(aCode(I),"#}")(0)&"#}"
Next
Response.WritesNewCode
%>
2. Regular method:
The code copy is as follows:
<%
DimsCode, sNewCode, oTempReg, Match, Matches
sCode="asdfasdlfajsodf{#kljlkkm#}ojgvjfkdsf{#wdfs#}llsdflksdf"
SetTempReg=NewRegExp
WithTempReg
.IgnoreCase=True
.Global=True
.Pattern="/{/#.+?/#/}"
SetMatches=.Execute(sCode)
ForEachMatchInMatches
sNewCode=sNewCode&Match.Value
Next
EndWith
SetTempReg=Nothing
Response.WritesNewCode
%>