Unresolved reference

Hi,
I really cannot understand what unresolved difference means. There is no pointers in this piece of code?

text = strings.ToLower(text)
	err, re := regexp.Compile("\\w+")

	if err != nil {
		log.Fatal(err)
	}
	sentence := re.FindAllString(re, -1)

Hi @Dj_Sparks,

I believe you meant to write the following as you have accidentally inverted err and re as well as passed re instead of text to FindAllString:

text = strings.ToLower(text)
re, err := regexp.Compile("\\w+")
if err != nil {
    log.Fatal(err)
}

sentence := re.FindAllString(text, -1)
2 Likes

Thanks a lot! I wish it was only accidental…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.