Filtering on a Template variable

How can I filter a variable in a template so that I can extract a fact

Trying to get the default ipv4 address from a template

template.j2
ipv4 address ((ansible_default_ipv4 | grep address}}

A similar format will work via command line but not via a template. Whats the correct formatting required to do something like that via template?

Thanks

ipv4 address {{ ansible_default_ipv4.address }}

That works thanks. I suppose what confused me a little was when trying to do this via command line I had to use grep…

[ansible@localhost exercises]$ ansible local -m setup -a ‘filter=ansible_default_ipv4*’ | grep address