• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validating domain name with struts validator

 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me write proper validation for validating a domain name (only SLD), I am trying few things wit RegEx but guess I am not very comfortable with regular expressions now.

The conditions for valid domain mae are as follow -

* Domain Name must be composed of the letters a through z, the numbers 0 through 9, and the hyphen (-) character.
* The Domain Name must not begin or end with the hyphen character.
* The Domain Name must not contain spaces.
* The Domain Name must not contain special characters other than the hyphen character.
* The Domain Name must contain 2 to 63 characters, inclusive.
* Domain Names are not case sensitive.

What should I put in this mask now considering the conditions mentioned above?



TIA,
- Manish
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic