0 Replies Latest reply on Dec 8, 2006 4:55 AM by jcastelain

    A RegExp to validate "comain name"

    jcastelain
      Hi everyone,

      I just started with Regular expressions, i found a good exercise to know if i could make some of it stick in my head :)
      So what i need to check is if the user enters a valid domain name (with the tld's provided in the RegExp)

      I'd like to know if this is right ?

      var example:RegExp = /^[a-z0-9]+.(com|eu|fr|info|net|org)/;

      if i try

      trace(example.test("adobe.com")); // returns true
      trace(example.exec("google.com")); // returns google.com, com

      so did i understand something, or do i still have to read the docs, to understand :)

      thanks a lot for your help