title: How to tell if a random string is an email address or something else
body: <p>I don't think that this question has been asked before... I certainly cannot find something with this requirement.</p>
  <h1>Background</h1>
  <p>There is an API that returns ID's of people. In general the ID should be treated as being case sensitive... but if the ID is actually their email address... and you are talking to a less than stellar implementation of this API that returns a mixed case version of their email address, there is plenty of fun to be had...</p>
  <p>So you are talking to one implementation... it gives you back URL like things as the ID, e.g.</p>
  <ul>
  <li><code>http://foo.bar.com/blahblahblah</code></li>
  </ul>
  <p>You could next be talking to another implementation... that gives you back some non-obvious ID, e.g.</p>
  <ul>
  <li><code>as€jlhdésdj678hjghas7t7qhjdhg£</code></li>
  </ul>
  <p>You could be talking to a nice implementation which gives you back a nice lowercase email address:</p>
  <ul>
  <li><code>bob.mcspam@acme.org</code></li>
  </ul>
  <p>Or you could be talking to the less than stellar implementation that returns the exactly equivalent ID</p>
  <ul>
  <li><code>bob.mcspam@ACME.org</code></li>
  </ul>
  <p>RFC 2821 states that only the mailbox is case sensitive, but that exploiting the case sensitivity will cause a raft of inter-op issues...</p>
  <p>What I want to do is identify the strings that are emails and force the domain to lowercase. Identifying the URI like strings is easier as the scheme is either <code>http</code> or <code>https</code> and I just need to lowercase the domain name which is a lot easier to parse.</p>
  <h1>Question</h1>
  <p>If given a string provided by an external service, is there a test I can use that will determine if the string is an email address so I can force the domain name to lower case?</p>
  <p>It is acceptable for a small % of email addresses to be missed and not get the domain name lowercased. (False negatives allowed)</p>
  <p>It is not acceptable to force part of a string to lowercase if it is not the domain part of an email address. (False positives not allowed)</p>
  <h2> Update</h2>
  <p>Note that this question is subtly different from <a href="https://stackoverflow.com/questions/624581/what-is-the-best-java-email-address-validation-method">this</a> and <a href="https://stackoverflow.com/questions/153716/verify-email-in-java">this</a> as in the context of those two questions you <em>already know that the string is supposed to be an email address</em>.</p>
  <p>In the context of this question we do not know if the string is an email address or something else... which makes this question different</p>