Jinja2 regex thorugh custom filters or any other

Hello my friends,

I’m creating a custom template for invoices, in the field:

{{ doc.address_display}}

bring too much info(from imported data), so i just want to cut the last three lines, they are something like that:

Phone: +1231231

I want just from first Blahh too the line before Phone:… With regex it’s too easy to do this, but with default jinja2 replace, i can’t make it.

If you can guide me on this, i would appreciate it!

does this work?

{{ doc.address_display.split("Phone:")[0] }}
1 Like

This work like a charm!

This work like a charm!

BTW, any python str method will work that way?

Thx… Again!

Not a Jinja expert myself, but I guess should work.