by Luuk » Thu Jun 24, 2021 1:21 am
This a "v2" regex for 'yy mm dd' formatted dates, and both sides of the date must be space-separated away from words...
If 'yy' starts with 0-2, the first regex converts yy ==> 20yy, if it starts with 3-9, the second regex converts yy ==> 19yy.
Both of the first two regexs also insert the ":" character to make a unique separator for the months, like therube is describing.
All of the other regexs just replace ':MonthNumber' ===> 'MonthAbbreviation'
(.+ )([0-2]\d )([01]\d [123]\d .+)(?X)(.+ )([3-9]\d )([01]\d [123]\d .+)(?X):01(?X):02(?X):03(?X):04(?X):05(?X):06(?X):07(?X):08(?X):09(?X):10(?X):11(?X):12
${1}20$2:$3(?X)${1}19$2:$3(?X)Jan(?X)Feb(?X)Mar(?X)Apr(?X)Mai(?X)Jun(?X)Jul(?X)Aug(?X)Sep(?X)Okt(?X)Nov(?X)Dez
If needing to make modifications, remember that (?X) separates each Match and Replace, so if wanting to make "words" optional, it can be like...
(.*)([0-2]\d )([01]\d [123]\d.*)(?X)(.*)([3-9]\d )([01]\d [123]\d.*)(?X):01(?X):02(?X):03(?X):04(?X):05(?X):06(?X):07(?X):08(?X):09(?X):10(?X):11(?X):12
${1}20$2:$3(?X)${1}19$2:$3(?X)Jan(?X)Feb(?X)Mar(?X)Apr(?X)Mai(?X)Jun(?X)Jul(?X)Aug(?X)Sep(?X)Okt(?X)Nov(?X)Dez
The javascript does also probably conduct all of this to be much easier, but Im not expert with the javascript code.
So it would probably take me much longer to discover the javascript twin that conducts like this "v2" regex.