# Ansible nested variable regex search

**URL:** <https://forum.ansible.com/t/ansible-nested-variable-regex-search/30293>\
**Category:** Ansible Project\
**Created:** [May 9, 2019, 5:03pm UTC](https://forum.ansible.com/t/ansible-nested-variable-regex-search/30293 "2019-05-09T17:03:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srikanth\_Ethiraj](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Srikanth\_Ethiraj](https://forum.ansible.com/u/Srikanth_Ethiraj)\
**Post date:** [May 9, 2019, 5:03pm UTC](https://forum.ansible.com/t/ansible-nested-variable-regex-search/30293/1 "2019-05-09T17:03:40Z")

</div>

How do we do a wildcard search with ansible nested variable?

```auto
test:
  name:
    address:
         zipcode: 12345

```

Ansible nested variable -

`{{ test[name][addre*].zipcode }}`

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [May 10, 2019, 10:22am UTC](https://forum.ansible.com/t/ansible-nested-variable-regex-search/30293/2 "2019-05-10T10:22:57Z")

</div>

You can't use glob characters for keys.  
Use the json query filter instead:  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_filters.html#json-query-filter](https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#json-query-filter)
