Hi and thanks for the reply.
Syntax is ok, it is similar to other languages. The problem is that findRE function in Hugo does not return capturing groups (both named or not).
Yes, that works if the string is exactly that one “%%customerNumber%%”. But, my fault, I haven’t properly explained my use case.
Imagine you have strings like this one:
There are %%customersNumber%% customers in %%storesNumber%% stores.
and you want to extract “customerNumber” and “storesNumber”. Actually you want to extract whatever is between two %% delimiter in non greedy way.
In other contexts I’ve always been using group submatching , but as far as I understood, there’s no support in Hugo templating code for that.
As a workaround now I clean the matches using a replace $match "%%" "" to remove the “%%”
{{ range $match := findRE "%%(.*?)%%" $theString }}
{{ $cleanMatch := replace $match "%%" "" }}
<!-- some other sutff down here -->
{{ end }}