Quote:
Originally Posted by jelzin
Thanks chaley, you made my day!
I took it a step forward to create a hierarchy date format with this code:
Code:
program:
list_split(list_re(field('tags'), ',', '\d{4}-\d{2}-\d{2}', '') , '-' , 'vars');
strcat(vars_0,'.',vars_1,'.',vars_2)
This will change the extracted date (eg. 2021-03-15) to 2021.03.15
It may not be the nicest code but it works!
|
That is a nice use of list_split().

It makes it really easy to do post processing on the values. For example, you could easily add a hierarchy level for the decade or century.
Another quite similar way to do it would be to use the replacement pattern in list_re:
Code:
program: list_re(field('tags'), ',', '(\d{4})-(\d{2})-(\d{2})', '\1.\2.\3')
This implementation isn't better in any cosmic sense, but if someone is very familiar with regular expressions it might be easier to understand.