0

Possible Duplicate:
Regular expression to match hostname or IP Address?

I need to validate a string that should contain DNS. Which regex is appropiate?

Community
  • 1
  • 1
Kaan
  • 902
  • 2
  • 16
  • 38

4 Answers4

4

This regex should work: .*DNS.*

Robert Love
  • 12,447
  • 2
  • 48
  • 80
2

Using regexlib works wonders!

http://www.regexlib.com/Search.aspx?k=dns

Leom Burke
  • 8,143
  • 1
  • 35
  • 30
1

It seems someone asks this question yet, try to search before asking see this

Community
  • 1
  • 1
Arsen Mkrtchyan
  • 49,896
  • 32
  • 148
  • 184
0
(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)
Svisstack
  • 16,203
  • 6
  • 66
  • 100