5 ms·
Not to be "that guy", but that isn't really a regular expression unless you are searching for nan.com, nano.com, nanoo.com, etc. I think you want: ^nano\w+\.
by tdavis 18y ago
Not to be "that guy", but that isn't really a regular expression unless you are searching for nan.com, nano.com, nanoo.com, etc. I think you want:
^nano\w+\.com$
- viggity 18y agoNot to be "that guy", but the word character class includes underscores, which is not valid in a domain name. What you would really want is ^nano[a-z0-9-]+[a-z0-9]+.com$ The first character class includes the hyphen, the second does not, because you can't start or end a domain with a hyphen.
- viggity 18y agoon further thought, it doesn't matter than it will match underscores, because the list of domains shouldn't have any underscores in them, but you would still want to look for underscores (maybe) ^nano[\w-]+\w+.com$
- tdavis 18y agoUnless the service was in the habit of selling impossible domain names, it shouldn't matter ;) I intentionally left out the hyphen because it isn't a very desirable character.
- ratsbane 18y agoThat regexp would allow a hyphen as the first character. How about this (still assuming .com is the only permitted TLD): [a-z0-9][a-z0-9-]*[a-z0-9].com$