Thanks @alexandros. I tried replaceRE `^\((\S{3,7})? *Windows\)$` `$1` and replaceRE "^\\((\\S{3,7})? *Windows\\)$" "$1" and both worked.
But I don’t understand what’s the difference between ` and " while specifying parameters in Hugo function (here replaceRE). Also, I was using \ to escape ( and ), so why should I escape \ in itself?
Apparently the backtick is a special way to quote regular expression strings without Go templates complaining. I discovered this feature on my own. It is not documented as far as I know.
Regarding the need to escape the backslash again this is due to the Go templates package that Hugo uses. There are several threads in the forum about this quirk, if you want to look it up search the forum for invalid syntax
Personally I use backticks when possible since it is cleaner than escaping backslashes.
I see. Interesting. Maybe in Hugo Docs, the example given should use ` rather than ", or atleast a note in this regard…? Is it fine if I submit a pull request?