Given such a code:
str := "hi hey hello"
regexpr := `(?i)hello|hey|hi`
fmt.Println(regexp.MustCompile(regexpr).FindStringSubmatch(str))
it gives such result:
[hi]
But I want to get a [hello]
as a result. Because in my case 'hello' is first priority, second priority is 'hey', and then 'hi'. How can I achieve it ?
I only know the solution to put keywords in slice and loop it. But it would not with single regexp operation.
Is it possible to do with single regexp operation ?