Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You didn't mention <a href="http://docs.python.org/library/re.html#re.findall" rel="nofollow"><code>re.findall()</code></a> in the list of things you tried. That gives you a list of all regex matches. </p> <p>However, you need to use all non-capturing groups <code>(?:...)</code>, or you'll get a list of all matched groups <code>(...)</code>. Therefore, I suggest</p> <pre><code>pattern = """ (?:September|April|June|November) ,[ ] (?:0?[1-9]|[12]\d|30) ,[ ] (?:19|20)\d\d # Months with 30 days | (?:January|March|May|July|August|October|December) ,[ ] (?:0?[1-9]|[12]\d|3[01]) ,[ ] (?:19|20)\d\d # Months with 31 days | February ,[ ] (?: (?:0?[1-9]|1\d|2[0-8]) ,[ ] (?:19|20)\d\d | 29 ,[ ] (?: (?:19|20) (?:04|08|12|16|20|24|28|32|36|40|44|48| 52|56|60|64|68|72|76|80|84|88|92|96) | 2000 ) ) # February with 28 days or 29 with a leap year""" </code></pre> <p>But do you really need to validate the correctness of the dates? Are you expecting false dates like <code>February, 31, 2000</code> to turn up in your data? If not, you could simplify your regex enormously. Or at least delegate date validation to a date parsing function which is better equipped for this task than a monstrous regex.</p> <p>For example:</p> <pre><code>pattern = """ (?:January|February|March|April|May|June| July|August|September|October|November|December) ,[ ] [0-3]?\d ,[ ] (?:19|20)\d\d """ </code></pre> <p>matches nonsense like <code>January, 0, 1999</code> or <code>February, 31, 2000</code>, but would it really matter?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload