Regular Expression with letter
<p>I need to match things that format something along the lines of 
657432-76,   54678-01,   54364<strong>A</strong>-12</p>

<p>I got <code>(r'^\d{6}-\d{2}$')</code>
and   <code>(r'^\d{5}-\d{2}$')</code>
but how do you get the letter?</p>

<p>thanks!!</p>

<p>Here's a possible candidate matching all your samples:</p>

<pre><code>import re

samples = [
    "657432-76",
    "54678-01",
    "54364A-12"
]

for s in samples:
    print re.match(r'^(\d+[A-Z]?)-(\d+)$', s).groups()
</code></pre>

python regex format expression