Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to I do a search for @anydomain.anyTLD using regular expressions?

share|improve this question
up vote 3 down vote accepted


You could improve that but I don't think n++ deals with more complicated regex patterns.

Ideally we'd just use something like


Which supports everything from the iana TLD list But N++ doesn't support that.

And if we want to get fancy we could do


Which supports RFC2822 (see here for more details)

share|improve this answer
1 would like to speak to you, it's 4 characters. I've found that exact regex matching is often far more trouble than it's worth - for example with to. A more exact regex might miss it, but I was using (https?://[^\s]*), a much more general expression, and it worked fine. – Phoshi Jun 8 '10 at 20:21
You are most correct, I have changed the above to work with websites such as – Incognito Jun 8 '10 at 20:30
@user25866: That wasn't my point. How about Indeed, the current technical maximum for a tld is 64 characters, and to is the TLD! +1 for a correct answer, but your "ideal" regex is far from it. – Phoshi Jun 8 '10 at 20:35
Added one that gets real fancy. – Incognito Jun 8 '10 at 20:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.