Python - combine regex patterns
<p>I have a large text and the aim is to select all 10-character strings for which the first character is a letter and the last character is a digit. </p>

<p>I am a python rookie and what I managed to achieve is to find all 10-character strings:</p>

<pre><code>ten_char = re.findall(r"\D(\w{10})\D", pdfdoc)
</code></pre>

<p>Question is how can I put together my other conditions: apart from a 10-character string, I am looking for one where the first character is a letter and the last character is a digit. </p>

<p>Suggestions appreciated!</p>

<p>thank you very much for a great discussion and interesting suggestions. Very first post on stack overflow, but wow...what a community you are! </p>

<p>In fact, using: </p>

<pre><code>r'\b([a-zA-Z]\S{8}\d)'
</code></pre>

<p>solved my problem very nicely. Really appreciated all your comments.</p>

python regex