I'm trying to use named groups in regex to reduce the size of the regex. However, even in its simplest form and after clearing all the 'noise', I cannot get it to work.
When I try the example in the documentation of regex101 it works.
/(?<first>a+) and again (\k<first>)/
here is my simplest example and it's not working.
(?<months>December)|^(next)\s(\k<months>)
here is the input "next" is not matching.
next December
December 2020
I would expect "next December" to match for the first row but instead, it's only matching "December" in both rows.
you can find the regex here https://regex101.com/r/aEgfe8/3/
The documentation only mentions that the named group has to be on the left.
What am I missing?