Forum Moderators: open
What I would like to do is to have my asp script find those like words inside the message text box and flag it as spam (I already have the flagging part done) All I need is to figure out how to find those words when they are randomly placed through out the message (I hope that makes sence.)
I know this usually isn't the best way to prevent spam, but I figure it will help me to sort it all out.
Thanks for any help anyone may have!
-Trae
For searching patterns in pieces of text the RegExp object is used in vbscript. Below some example script where we search for the word "forbidden"
<%
StringToSearch = "this is the text that needs to be searched and contains the forbidden word"
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
.Pattern = "forbidden"
.IgnoreCase = False
.Global = True
End With
Set expressionmatch = RegularExpressionObject.Execute(StringToSearch)
If expressionmatch.Count > 0 Then
For Each expressionmatched in expressionmatch
Response.Write "<B>" & expressionmatched.Value & "</B> was matched at position <B>" & expressionmatched.FirstIndex & "</B><BR>"
Next
Else
Response.Write "<B>" & RegularExpressionObject.Pattern & "</B> was not found in the string: <B>" & StringToSearch & "</B>."
End If
Set RegularExpressionObject = nothing
%>