title: Match only one character out of a set of characters in Python
body: <p>I'm writing a CLI program in Python and would like to ask the user to choose one of 3 options by pressing a key on the keyboard, say A, B and C. </p>
  
  <p>The user should be able to use only a, b, c, A, B and C to specify an option.</p>
  
  <p>AAA, BB, AB, CBA.. should all be invalid options.</p>
  
  <p>To achieve this, I tried using the re library so far, with unsuccessful attempts:</p>
  
  <pre><code>&gt;&gt;&gt; p = re.compile('[abc]', re.IGNORECASE)
  &gt;&gt;&gt; p.match('ab') == None
  False
  &gt;&gt;&gt; p = re.compile('[a|b|c]', re.IGNORECASE)
  &gt;&gt;&gt; p.match('ab') == None
  False
  &gt;&gt;&gt; p = re.compile('[a|b|c]{1}', re.IGNORECASE)
  &gt;&gt;&gt; p.match('ab') == None
  False
  </code></pre>
  
  <p>Maybe using regular expressions is a bit too much for such a simple task, but I would like to know how this could be done using regex. It seems quite simple but somehow can't get it to work...</p>