I have the same problem as the one in the link but in PCRE2 (regex101.com):
Regexp find a match with priority order?
I have:
/.*?(hello)|.*?(hey)|.*?(hi)/ms
hi hey hello
But the problem is that when it finds hello
, it is stored in group 1, when it finds hey
in group 2, and when it finds hi
in group 3, I want only group 1 to be used instead.
How do I get this?