replaceRE lookbehind

I read that golang doesn’t have lookahead/lookbehind in regex, so how do I achieve the following requirement?

I want to remove the dots in all occurrence of: class=".class1 .class2 (possibly more) " so the output becomes: class=“class1 class2 “. It would be simple if there’s only one class per element, I’ll just use replaceRE class=”[.]([^. ]+)”, however if the number of classes is unknown, I can’t figure out how to replace for all occurrences without lookahead/lookbehind, since bracket only returns the last group of a match.

I thought about use range and findRE, but variables within {{ range }} is local and can’t easily replace variable outside of it.

Why not just use replace?

{{replace $foo "." "" }}

Well I only want to replace the dots within class="***", and not dots in the content, such as periods.
I thought about using range | findRE to separate lines with class then use replace, but then I can’t replace the original variable with {{ . }} within range.