hugo-docs-concept
hugo-docs-concept copied to clipboard
Add some common examples for using Regex with the ReplaceRe and findRE functions
Noting the docs on ReplaceRe don't mention some of the stuff in this thread: https://discuss.gohugo.io/t/replacere-not-working-for-me-solved/5103/3?u=budparr and probably should.
Might be "neat" to add a few more common examples, like for currency, etc. Probably wouldn't be much for some of Hugo's contributors (i.e. not me 😸 ) to come up with a few.
I like the idea of expanding on Go's RegEx flavor and am always for more examples.
Last time anything regex-y was brought up was in this thread, which made me question the future of the functions or, at least, how much they should be promoted. Thoughts?
https://github.com/spf13/hugo/issues/3188
That thread seems to me to be saying that replaceRE
shouldn't have been used in the example in the docs, not that replaceRE
shouldn't be in Hugo.
replaceRE
isn't going away.
We can work on the examples later, but I've at least added a note with relevant links: https://github.com/rdwatters/hugo-docs-concept/commit/777f1cefaf9bf8030cdba465d7f11a007d5be370
And live:
https://hugodocs.info/functions/replacere/ https://hugodocs.info/functions/findre/
Could also mention that https://regex101.com/ has a golang
pattern testing mode.