News for hackers. Stuff that matters.
Re:Ask HN: Domain name searching by tdavis on Saturday April 04, 2009 @02:49AM (#546162)
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$
Re:Ask HN: Domain name searching by viggity on Saturday April 04, 2009 @09:16AM (#546298)
Not 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.
Re:Ask HN: Domain name searching by ratsbane on Sunday April 05, 2009 @07:41AM (#547298)
That 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$
Re:Ask HN: Domain name searching by viggity on Saturday April 04, 2009 @11:56AM (#546393)
on 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$
Re:Ask HN: Domain name searching by tdavis on Saturday April 04, 2009 @02:25PM (#546511)
Unless 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.