Javascript form validation/sanitizing do i need regex here ?

Posted by user318144 on Stack Overflow See other posts from Stack Overflow or by user318144
Published on 2010-04-16T02:10:56Z Indexed on 2010/04/16 2:13 UTC
Read the original article Hit count: 236

Filed under:
|

I have a single form input that is for checking domains. Sometimes people type in www. before the domain or .com after the domain name. The service that i use to check availability automatically checks for all top level domains so when people add the .com at the end it becomes redundant. For example the string submitted is domainname.com.com which is clearly invalid.

I understand you can do this on the server side but due to some rather weird circumstance i must use javascript for this. So is regex the solution here ? If so is there some kind of regex generator i can use for this or can someone point me in the right direction with a code snippet perhaps ?

Appreciate any help thanks!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex