Regular Expression matching a specific domain

  • Thread starter Thread starter John Meyer
  • Start date Start date
J

John Meyer

Does anybody know the regular expression that would match a specific
domain (say foobar.com)

John Meyer
Freelance Consultanthttp://www.pueblonative.com/blog

If something goes wrong at the plant,  blame the guy who can’t speak
English.
  */Homer Simpson/*

--- @ WiseStamp Signature
<http://my.wisestamp.com/link?u=42bgx5rfnpr43zfj&site=www.wisestamp.co...>.
Get it now
<http://my.wisestamp.com/link?u=42bgx5rfnpr43zfj&site=www.wisestamp.co...>

Hi John,

Try this pattern (for more: regexlib.com):

"^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$"

' To test
Dim txt As New System.Text.RegularExpressions.Regex _
("^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$")
If txt.IsMatch("foobar.com") = True Then
MsgBox("matches!")
End If

HTH,

Onur Güzel
 
Back
Top