title: Regular expressions exclusive or
body: <p>I am trying to write a section of regular expression where it accepts either word characters or numbers, but not both (exclusive or).</p>
  
  <p>Right now I have:</p>
  
  <pre><code>[\w\d]+
  </code></pre>
  
  <p>To represent a word that is made of either digits or letters/underscores. But that still lets things like 5x and 143243243243242323a pass through, because technically they are letters or numbers. I have tried things like <code>[\w]+|[\d]+</code> but it has not worked for me so far. Any help?</p>