/VbScript/spamFilter.asp
http://github.com/teamaton/toolbelt · ASP · 33 lines · 32 code · 1 blank · 0 comment · 5 complexity · 797419a0a1b8986895221e536459bd29 MD5 · raw file
- <%@ language="VBSCRIPT" %>
- <%Option Explicit '*** This must be the FIRST statement ***%>
- <div>
- <%
- dim validChars, textNo, textYes, phoneRegex
- validChars = "123"
- textNo = "123 hallo"
- textYes = "(+34) 45/345-567-00.32"
-
- Function isPhoneNumber(text)
- dim phoneRegex, i
- Set phoneRegex = new regexp 'Create the RegExp object
- phoneRegex.Pattern = "^[\d\.\(\)/+ -]*$" ' allow only: 0123456789./()-+ and space
- phoneRegex.IgnoreCase = true
- i = 0
- while i < 3
- i = i+1
- wend
- isPhoneNumber = phoneRegex.Test(text)
- End Function
- %>
- <% if isPhoneNumber(textNo) then %>
- false
- <% else %>
- true
- <% End If%>
- <hr />
- <% if isPhoneNumber(textYes) then %>
- true
- <% else %>
- false
- <% End If%>
- </div>