# How to get the version of the installed package with regexp via Ansible?

**URL:** <https://forum.ansible.com/t/how-to-get-the-version-of-the-installed-package-with-regexp-via-ansible/24525>\
**Category:** Ansible Project\
**Created:** [May 19, 2017, 4:12pm UTC](https://forum.ansible.com/t/how-to-get-the-version-of-the-installed-package-with-regexp-via-ansible/24525 "2017-05-19T16:12:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user91](https://avatars.discourse-cdn.com/v4/letter/u/a8b319/32.png) [@user91](https://forum.ansible.com/u/user91)\
**Post date:** [May 19, 2017, 4:12pm UTC](https://forum.ansible.com/t/how-to-get-the-version-of-the-installed-package-with-regexp-via-ansible/24525/1 "2017-05-19T16:12:50Z")

</div>

There are several packages with a common name: package-somethins1 package-special

`

```auto
---
- hosts: Special_hosts
  name: "Get version of RPM"
  tasks:
    - name: yum_command 
      yum:
        list=installed
      register: yum_packages

    - debug: var=item
      with_items: "{{yum_packages|json_query(jsonquery)}}"
      vars:
        jsonquery: "results[?name=='package*']"

```

`

How to get the version of the installed package with regexp via Ansible?
