Regular Expression matching a specific domain

J

John Meyer

O

Onur Güzel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top