how to compare lists whose elements are regular expressions in Ansible?

Hi Team

I wish to compare two lists, one list has regex expression and the second has ordinary data and return a match. Please help

e.g.


list1:
   - linux.*
   - 6.*
   - mysql|python|gvim

list2:
   - linux
   - 6.0.1
   - mysql
Thanks

See "Testing strings" and chose from “match”, “search” or “regex”.
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#testing-strings

For example, the task below "match" items of the lists

    - debug:
        msg: "{{ item.0 is match(item.1) }}"
      loop: "{{ list2|zip(list1)|list }}"

If "compare two lists" means you want to know whether all items match
or not, create new list and test all items in it at once. For example
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#test-if-a-list-contains-a-value

    - set_fact:
        list3: "{{ list3|default() +
                   [item.0 is match(item.1)] }}"
      loop: "{{ list2|zip(list1)|list }}"
    - debug:
        msg: "{{ list3 is all }}"

Thanks for your response,

I have still issue when there are two elements matched in regex pattern. please help

Playbook: