HUGO

replaceRE error with escaped square bracket

Hi !

I am trying to clean-up the [^1] footnotes syntax in a json layout to build a search index (as in A simple javascript based full text search function).

When using | replaceRE "\[\^([^\]])+\]" " ", I get an invalid syntax whereas I think it should not (this is proper RE as checked on https://regex101.com and in the Golang flavor.

Does anyone has a clue on how to make it work please ?

Best regards,

Hugues

Try wrapping the regex in backticks instead of quotes i.e. `

1 Like

awesome ! thanks !

Or backslash the quotes inside. But backticks work much better.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.