jgillula / paperless-ngx-postprocessor

A powerful and customizable postprocessing script for paperless-ngx
GNU Affero General Public License v3.0
97 stars 10 forks source link

Add custom jinja filters "regex_match" and "regex_sub" #3

Closed saladpanda closed 1 year ago

saladpanda commented 1 year ago

These allow for actions like extracting the creation date from the original filename. See the rule "Parse creation date from filename" in example.yml for an example use case.

jgillula commented 1 year ago

At first I thought this would add unnecessary complexity, but actually this makes things even more powerful. I like it a lot! Thanks for your contribution!

cookyr commented 6 months ago

Hi, I want to use regex_sub to extract time information from filenames. But this function is not working for me, same for example.yml. I tried in the metadata_postprocessing section:

yy: '{{ "2099-05-4-kaese" | regex_sub(".(\d{4}).","\1") }}' title: 'test-{{yy}}-end'

There's no error in webserver's log but document arrves in paperless as 'test--end' I also tried to use re.sub directly, as far as I understood jinja this could be feasible?!?

Any idea?

Best regards Rüdiger