Hi,
I spend a few hours today, to solve this. Im trying to solve this with use of regex
{{ findRE "(?:(\d+)H)?(?:(\d+)M)?" $.preparation_time }}
I get error invalid syntax
I then try many different one. Even this simple one I cannot get it to work.
{{ findRE "\d" $.preparation_time }}
This one should return all the numbers from "1H30M"
string.
Is there any difference regarding regex in hugo? I check if this works here https://regex101.com and here I got result without a problem. Is it possible to work with capturing groups in hugo?
UPDATE
I added additional \
so "(?:(\d+)H) this one runs without any compile error. Just the result is not satisfying. This example returns array with just one item [1H]
. I would like to achieve [1]
.
I will try to work now on finding the right regex, but any help from you guys will be appreciated.