Invalid syntax with findRE [SOLVED]

I’m trying to use findRE to find content in the .Title variable that’s between this symbol:

`

My current code is:

{{ .Title | findRE "\`.*?\`" }}

I’ve validated this with a golang online expression tester (here) and it works there. Hugo, however, generates the “invalid syntax” error.

I’ve checked the re2 syntax rules, and looked at the docs (both sites), but can’t figure out where I go wrong. I also played around with the Go playground example that moorereason shared in an earlier thread but that also didn’t move me closer towards a solution.

As before, you likely need to escape the backslash in your pattern string.

{{ .Title | findRE "\\`.*?\\`" }}
1 Like

Thank you! I thought I already tested that case but apparently not since it works like a charm. What a pair of different eyes can do. :slightly_smiling: