title: Is something wrong with my regex?
body: <p>I made an XML Schema and I have this in it.</p>
  
  <pre><code>&lt;xs:element name="Email"&gt;
          &lt;xs:simpleType&gt;
            &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"/&gt;
            &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
        &lt;/xs:element&gt;
  </code></pre>
  
  <p>Some of my emails in one of my XML documents fail and I get this error</p>
  
  <blockquote>
    <p>Email' element is invalid - The value
    'Some_Name@hotmail.com' is invalid
    according to its datatype 'String' -
    The Pattern constraint failed.
    LineNumber: 15404 LinePostion: 32</p>
  </blockquote>
  
  <p>So just looking at all the emails that passed and the ones that failed I noticed that all the ones that failed have an "_(underscore)". So I am unsure if this is the reason or not.</p>
  
  <p>Edit</p>
  
  <p>So I changed my regex to this</p>
  
  <pre><code> &lt;xs:pattern value="[\w_]+([-+.'][\w_]+)*@[\w_]+([-.][\w_]+)*\.[\w_]+([-.][\w_]+)*"/&gt;
  </code></pre>
  
  <p>It now works but don't understand why <code>\w</code> is not capturing it.</p>