Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    regular expression validation for url

    Hi all,

    Please help in validating url like -
    www.domainame.com
    And it should not check for (http://) using regular expression.
    I am trying but finding difficult to solve it

    Regards,
    Navin[/color]

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,159
    Thanks
    203
    Thanked 2,548 Times in 2,526 Posts
    if(/www\.[a-z0-9][a-z0-9\-]{0,61}[a-z0-9]\.[a-z\.{2,6}]$/gi.test(url.value)) { // return true

    This permits but does not require characters (such as http://) before the www.

    The only valid characters for a domain name are letters, numbers and a hyphen "-". Hyphens may be anywhere in the middle of a name, but can not be located at the end or beginning of a name. A valid domain name does not have spaces. The domain name without the extension can be up to 63 characters.



    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 09-04-2008 at 12:20 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •