Ansible syntax for regex_search using variable to match

Not the most beautiful thing but this works:

- item.key | regex_search('^' + vcsourcekit | string)

Without the cast to string, I get a cannot concatenate 'str' and 'int' objects on ansible 2.2.0.0 and I don't have time to update just now.


This concatenation works without casting :

when:
      - item.key | regex_search('^(' ~ vcsourcekit ~ ')')
 with_dict: "{{ vmfacts.virtual_machines }}"

(Tested in Ansible 2.5.6)