#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)(?<!(?:\w+ *[=|] *|{{\w+ *\| *)[\w ]*)(?:(\d+(?:er)?|\d+{{er}}|{{\d+er}}) *)?(janvier|f[ée]vrier|mars|avril|mai|juin|juillet|a[ôo][ûu]t|septembre|octobre|novembre|d[ée]cembre) *(\d{3,4})"
Local $sString = " 1er mars 2020" & @CRLF & _
" {{1er}} mars 2020" & @CRLF & _
" 1{{er}} mars 2020" & @CRLF & _
" 1 mars 2020" & @CRLF & _
" 20 mars 2020" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"I don't want these ones:" & @CRLF & _
"date= 20 Mars 2025" & @CRLF & _
"date=20 Mars 2025" & @CRLF & _
"{{date|20 aout 2020}}" & @CRLF & _
"{{date| 20 aout 2020}}" & @CRLF & _
"" & @CRLF & _
"{{date|20 aout 2020}} 1{{er}} mars 2020 {{date|20 aout 2020}} 1{{er}} mars 2020 1{{er}} mars 2020 1 mars 2020 20 mars 2020 date=20 Mars 2025" & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
"12 octobre 2012" & @CRLF & _
"foo=12 octobre 2012" & @CRLF & _
"foo = 12 octobre 2012" & @CRLF & _
"bar|12 octobre 2012" & @CRLF & _
"bar | 12 octobre 2012"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm