rdwatters / hugo-docs-concept

NO LONGER MAINTAINED. See the official Hugo docs at /gohugoio/hugoDocs
17 stars 10 forks source link

Add some common examples for using Regex with the ReplaceRe and findRE functions #97

Open budparr opened 7 years ago

budparr commented 7 years ago

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.

rdwatters commented 7 years ago

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

budparr commented 7 years ago

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.

moorereason commented 7 years ago

replaceRE isn't going away.

rdwatters commented 7 years ago

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/

moorereason commented 7 years ago

Could also mention that https://regex101.com/ has a golang pattern testing mode.