Hi, I want to change the case of submatch of replaceRE
, something like following.
{{ $s := "http://gohugo.io/docs" }}
{{ replaceRE "^https?://([^/]+).*" "$1" $s }} → GOHUGO.IO, uppercase
Hi, I want to change the case of submatch of replaceRE
, something like following.
{{ $s := "http://gohugo.io/docs" }}
{{ replaceRE "^https?://([^/]+).*" "$1" $s }} → GOHUGO.IO, uppercase
{{ $s := "a 1b2 3c4 d" }}
{{ replaceRE `\d(\w)\d` "$1" $s }}
The above returns:
a b c d
If I understand your question correctly, you want it to return:
a B C d
Go’s regex implementation, adhering to RE2, has no provision for changing the case of the submatch.
Yes, that’s what I want, but it seems not supported by Go. Thank you.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.