PageRenderTime 104ms CodeModel.GetById 102ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/VbScript/spamFilter.asp

http://github.com/teamaton/toolbelt
ASP | 33 lines | 32 code | 1 blank | 0 comment | 5 complexity | 797419a0a1b8986895221e536459bd29 MD5 | raw file
 1<%@  language="VBSCRIPT" %>
 2<%Option Explicit '*** This must be the FIRST statement ***%>
 3<div>
 4	<%
 5dim validChars, textNo, textYes, phoneRegex
 6validChars = "123"
 7textNo = "123 hallo"
 8textYes = "(+34) 45/345-567-00.32"
 9
10Function isPhoneNumber(text)
11	dim phoneRegex, i
12	Set phoneRegex = new regexp 'Create the RegExp object
13	phoneRegex.Pattern = "^[\d\.\(\)/+ -]*$" ' allow only: 0123456789./()-+ and space
14	phoneRegex.IgnoreCase = true
15	i = 0
16	while i < 3
17		i = i+1
18	wend
19	isPhoneNumber = phoneRegex.Test(text)
20End Function
21%>
22	<% if isPhoneNumber(textNo) then %>
23	false
24	<% else %>
25	true
26	<% End If%>
27	<hr />
28	<% if isPhoneNumber(textYes) then %>
29	true
30	<% else %>
31	false
32	<% End If%>
33</div>