Strip Special Characters or REGEx in asp
---------------------------------------------------------------------------------------------
Strip Special Characters in ASP
Function StripSpecialChar(inStr)
dim sOut,outStr,arrSpecialChar,intCounter,arrSpecialChar1
' arrSpecialChar = Array("%20","&","&","#","+","@","(","","","","","","","","")
arrSpecialChar=Array("#","$","%","&","@","`","/",":",";","<","=",">","?","[","\","]","^","{","|","}","~","'","+",",")
outStr=replace(inStr," ","-")
intCounter = 0
Do Until intCounter = UBOUND(arrSpecialChar)+1
sOut = replace(outStr,arrSpecialChar(intCounter),"")
intCounter = intCounter + 1
outStr = sOut
Loop
StripSpecialChar = outStr
End Function
---------------------------------------------------------------------------------------------
Strip Special Characters in ASP
Function StripSpecialChar(inStr)
dim sOut,outStr,arrSpecialChar,intCounter,arrSpecialChar1
' arrSpecialChar = Array("%20","&","&","#","+","@","(","","","","","","","","")
arrSpecialChar=Array("#","$","%","&","@","`","/",":",";","<","=",">","?","[","\","]","^","{","|","}","~","'","+",",")
outStr=replace(inStr," ","-")
intCounter = 0
Do Until intCounter = UBOUND(arrSpecialChar)+1
sOut = replace(outStr,arrSpecialChar(intCounter),"")
intCounter = intCounter + 1
outStr = sOut
Loop
StripSpecialChar = outStr
End Function
---------------------------------------------------------------------------------------------
dim regEx
Set regEx = New RegExp
regEx.Pattern = "[ /\<|\>|\|\'|\%|\;|\(|\)|\&|\+|\/g]"
regEx.IgnoreCase = True
regEx.Global = True
regEx.Replace(fulltext,"-")
---------------------------------------------------------------------------------------------
dim regEx
Set regEx = New RegExp
regEx.Pattern = "(<a[^>]+>)|(<\/a>)"
regEx.IgnoreCase = True
regEx.Global = True
regEx.Replace(fulltext,"-")
---------------------------------------------------------------------------------------------
No comments:
Post a Comment