title: Beautiful Soup and regular expressions
body: <p>I am using Beautiful Soup to identify a specific tag and its contents. The contents are html-links and I want to extract the text of these tags.</p>
  
  <p>The problem is that the text is made up of different numbers according to a specific pattern. I am only interested in number such as "61993J0417" and "61991CJ0316" and I need the regexp to match both when the number has a "J" and "CJ" in the middle. </p>
  
  <p>I have used this code to achieve this:</p>
  
  <pre><code>soup.find_all(text=re.compile('[6][1-2][0-9]{3}[J]|[CJ][0-9]{4}'))
  </code></pre>
  
  <p>The soup variable is the contents of the specific tag. This code works in 9 out of 10 cases. However, when I run this script on one of my source files, it also matches numbers such as "51987PC0716".</p>
  
  <p>I cannot understand why so I turn to you for assistance. </p>