DodgeIntrepid.Net Forums banner

1 - 5 of 5 Posts

212 Posts
Here ya go!

Here's the solution: I hope this displays correctly

Dim arAdd(5)
Dim rgExpress

arAdd(0) = "[email protected]"
arAdd(1) = "Chris Gaddy"
arAdd(2) = "8500 Wolf Lake"
arAdd(3) = "901-555-3002"
arAdd(4) = "901-555-0608"
arAdd(5) = "[email protected]"

Set rgExpress = New RegExp

with rgExpress
.Pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
.IgnoreCase = True
.Global = True
End With

For i = 0 to 5
Response.Write "<br>" & rgExpress.Replace(arAdd(i),"")

Set rgExpress = Nothing

145 Posts
Discussion Starter #5 (Edited)
Hey Chris thanks! your code certainly prevents metas.

this is what i was using

<%@ Language=VBScript %>
<% Option Explicit %>
<% dim brin

brin = "[email protected]"

dim ExpressionChecker
dim exprChecked

Set ExpressionChecker = new RegExp

With ExpressionChecker
good characters.
.Pattern = "[\w\.-][email protected]([a-z0-9-]+\.)+[a-z]{2,}\.?$"
.IgnoreCase = false
.Global = true
end with

set exprChecked = ExpressionChecker.Execute(brin)
'"" if it agrees with the pattern restrictions then good email
if exprChecked.count > 0 then
response.Write "pattern was found, good email." & "<br>" & brin
'if it doesn't then bad email
response.Write " no pattern was found , bad email address" & "<br>" & brin

end if


i thought that [\w] was equivalent to [a-zA-Z_0-9] but for some reason it considered for example:

[email protected]#[email protected] - correct, but if did
@#[email protected] - it was incorrect. (I was missing a ^).:crazy: nevermind:crazy

one concern i have with you code, which mine also has it that is allows for example

[email protected]

it allows more than one dash or period in between words. any way to prevent this?


this one seems to work
^([\w](\.){0,1}(-){0,1})[email protected]([a-z0-9-]+\.)+[a-z]{2,}\.?$"

thanks again:
1 - 5 of 5 Posts