title: Regular expression, excluding .. in suffix of email addy
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address">Using a regular expression to validate an email address</a>  </p>
  </blockquote>
  
  
  
  <p>This is homework, I've been working on it for a while, I've done lots of reading and feel I have gotten pretty familiar with regex for a beginner.</p>
  
  <p>I am trying to find a regular expression for validating/invalidating a list of emails. There are two addresses which are giving me problems, I can't get them both to validate the correct way at the same time. I've gone through a dozen different expressions that work for all the other emails on the list but I can't get those two at the same time.</p>
  
  <p>First, the addresses.</p>
  
  <pre><code>me@example..com  - invalid
  someone.nothere@1.0.0.127  - valid
  </code></pre>
  
  <p>The part of my expression which validates the suffix</p>
  
  <p>I originally started with </p>
  
  <pre><code>@.+\\.[[a-z]0-9]+
  </code></pre>
  
  <p>And had a second pattern for checking some more invalid addresses and checked the email against both patterns, one checked for validity the other invalidity but my professor said he wanted it all in on expression.</p>
  
  <pre><code>@[[\\w]+\\.[\\w]+]+
  </code></pre>
  
  <p>or</p>
  
  <pre><code>@[\\w]+\\.[\\w]+
  </code></pre>
  
  <p>I've tried it written many, many different ways but I'm pretty sure I was just using different syntax to express these two expressions.</p>
  
  <p>I know what I want it to do, I want it to match a character class of "character+"."character+"+</p>
  
  <p>The plus sign being at least one. It works for the invalid class when I only allow the character class to repeat one time(and obviously the ip doesn't get matched), but when I allow the character class to repeat itself it matches the second period even  thought it isn't preceded by a character. I don't understand why.</p>
  
  <p>I've even tried grouping everything with () and putting {1} after the escaped . and changing the \w to a-z and replacing + with {1,}; nothing seems to require the period to surrounded by characters.</p>