Replace with regex?

How can I replace text with regex in Hugo’s HTML template?


{{ replace “abc abc” “^abc” “def” }}


def abc

You can not.

OK. Thanks.

I know you asked this a while ago, but now you can actually do regex replace content:

1 Like

Thanks @maximilian-lindsey! The nice thing about the replaceRE function is that you can also chain it multiple times, which you can’t do with replace. It would be nice if replace also supported this.