Finally I gave up with the regexp. I ended up leaning towards to using an action group. Thanks for your help, maybe in a future I'll try again hahaha. I'll left the entire actions if anyone is interested in using it.
[#0]
T=4
F=year
1=([\(\[\{])\s+|\s+([\]\}\)\?\:\;\,\!\.])
2=$1$2
3=0
[#1]
T=4
F=year
1=^\s+|\s+$
2=
3=0
[#2]
T=2
F=year
1=January
2=01
3=0|0
[#3]
T=2
F=year
1=February
2=02
3=0|0
[#4]
T=2
F=year
1=March
2=03
3=0|0
[#5]
T=2
F=year
1=April
2=04
3=0|0
[#6]
T=2
F=year
1=May
2=05
3=0|0
[#7]
T=2
F=year
1=June
2=06
3=0|0
[#8]
T=2
F=year
1=July
2=07
3=0|0
[#9]
T=2
F=year
1=August
2=08
3=0|0
[#10]
T=2
F=year
1=September
2=09
3=0|0
[#11]
T=2
F=year
1=October
2=10
3=0|0
[#12]
T=2
F=year
1=November
2=11
3=0|0
[#13]
T=2
F=year
1=December
2=12
3=0|0
[#14]
T=4
F=year
1=(\d{1,2})(st|nd|rd|th)
2=$1
3=0
[#15]
T=2
F=year
1=(\d{1,2})
2=$if($len($1)
3=0|0
[#16]
T=4
F=year
1=[\s\.,;!?\-()\[\]{}:\'"]
2=
3=0
[#17]
T=5
1=$if($eql($len(%year%),4),1231%year%,%year%)
F=year
[#18]
T=5
1=$if($eql($len(%year%),6),$left(%year%,2)01$mid(%year%,3,$len(%year%)),%year%)
F=year
[#19]
T=5
1=$if($eql($len(%year%),7),$left(%year%,2)0$mid(%year%,3,$len(%year%)),%year%)
F=year
[#20]
T=5
1=$if($eql($len(%year%),8),$mid(%year%,5,$len(%year%))$left(%year%,4),%year%)
F=year
[#21]
T=5
1=$if($eql($len(%year%),8),$left(%year%,4)-$mid(%year%,5,2)-$mid(%year%,7,2),%year%)
F=year
Edit: This is the breakdown of the actions:
[#0] - Remove unwanted characters in the year (spaces and punctuation characters)
[#1] - Strip leading/trailing spaces (just in case)
[#2] to [#13] - Replace month names with numbers
[#14] - Remove ordinal suffixes (st, nd, rd, th)
[#15] - Check if the year is numeric
[#16] - Remove special characters " [\s.,;!?-(){}:'"] "
[#17] to [#21] - Conditional year formatting based on length
- [#17]: If the
year length is 4, it adds "1231" before the year.
- [#18]: If the
year length is 6, it seems to add "01" in the middle.
- [#19]: Similar to [#18], but for a length of 7.
- [#20]: If the length is 8, it swaps the format to something that seems like a
date format.
- [#21]: If the value has 8 digits, it reformats to
YYYY-MM-DD.
The last section (actions from 17 to 20) it can be changed according to the user needs (if they need for a single year put "0101" or else).
That's it, this hurt me for a few hours, but i'm happy with the result.
Best regards.