0

With this code but without case sensitive. I want replace all word contain Esports, esports, eSports, ESports etc..

{{ $content := replace $content "Esports"  "<a href=\"https://example.com/esports/\" >Esports</a>" 1 }}
mobagenie
  • 31
  • 4

1 Answers1

1

You can use replaceRE which does a regex match and then use the i flag to make it case-insensitive.

{{ $content | replaceRE "(?i:esports)" "<a href=\"https://example.com/esports/\" >Esports</a>" }}

You may need to tweak the flags or the regex. This is just the gist. I have not tested it.

The Fool
  • 16,715
  • 5
  • 52
  • 86