title: How can I get my regular expression to work for all of my sample data
body: <p>I'm trying to write a regular expression that captures the following sample data:</p>
  
  <pre><code>BEL  p1       QUEEN ST.WEST-SMARTEN   FL          DARNLEY BAY      F  09  1116  Race 3
  BEL  p2       OUTSTAND-BOLD N'FLASHY   ON           WE’LL TALK      F  10  1116  Race 3
  BEL  p3       KAHLUA BAY-CATRAIL   KY             GO OLIVIA GO      F  10  1116  Race 3
  BEL  p4       FORTUNATE CHANCE-AMERICAN CHANCE   KYROSIE MY WAY      F  10  1116  Race 3
  BEL  p5       ARBORESQUE-CURE THE BLUES   AR    TAYLOR JAGGER      F  10  1116  Race 3
  BEL  p6       UNBRIDLED GLORY-UNBRIDLED   KYLOVE THE BREEDING      F  10  1116  Race 3
  </code></pre>
  
  <p>I have created a regular expression that has 9 capture groups:</p>
  
  <ol>
  <li>Track Code (BEL)</li>
  <li>Page number (p1)</li>
  <li>Sire &amp; Dam (QUENN ST.WEST-SMARTEN)</li>
  <li>Foaling State/Country (FL)</li>
  <li>Horse Name (DARNLEY BAY)</li>
  <li>Horse Gender (F)</li>
  <li>Year BorN (09)</li>
  <li>Distance of Race (1116)</li>
  <li>Race Number (Race 3)</li>
  </ol>
  
  <p>Here is my regular expression:</p>
  
  <pre><code>^([A-Z]+)\s+(p[0-9]+)\s+([-'A-Z,.\s]+)\s+([A-Z]{1,3})\s+([A-Z\s']+)\s+([F|M])\s+([0-9]{1,2})\s+(.*)\s+(Race\s.*)$  /gm modifiers
  </code></pre>
  
  <p>Unfortunately, my expression is only working on the 1st and 5th rows of my sample data. I believe Row 2 fails because the regular expression is not matching either the Sire &amp; Dam or the Horse's name.   The other rows that are not matched correctly seem to have something to do with the foaling state/country.  In some cases the State/Country field seems to be running into the Horse Name field so my regular expression is treating the sire/dam group as one  (combining sire/dam, foaling area and horse name).  </p>
  
  <p>Here is my regular expression and results on RegEx101: <a href="https://regex101.com/r/nU3iK3/1" rel="nofollow">MyRegular Expression</a></p>
  
  <p>I'd appreciate any suggestions you might have on how I can improve my regular expression. </p>