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
  • 15
  • 38

4 Answers4

4

This regex should work: .*DNS.*

Robert Love
  • 12,129
  • 2
  • 49
  • 78
2

Using regexlib works wonders!

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

Leom Burke
  • 8,040
  • 1
  • 34
  • 30
1

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

Community
  • 1
  • 1
Arsen Mkrtchyan
  • 48,710
  • 31
  • 147
  • 181
0
(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)
Svisstack
  • 15,446
  • 6
  • 63
  • 100