title: Is there a way to use a regular expression to match hosts in ansible?
body: <p>I am trying to match hosts using a regex pattern with ansible but it is not working as expected. 
  My inventory is as seen below:</p>
  
  <pre><code>[group1]
  hello1
  world1
  hello2
  world2
  
  [group2]
  hello3     
  </code></pre>
  
  <p>And my task is:</p>
  
  <pre><code>- debug:
      msg: "{{ item }}"
    with_inventory_hostnames:
      - ~hello*
  </code></pre>
  
  <p>From their documentation:</p>
  
  <pre><code>Using regexes in patterns
  You can specify a pattern as a regular expression by starting the pattern with ~:
  
  ~(web|db).*\.example\.com
  </code></pre>
  
  <p>When I execute the task there is no output. I am a n00b with regex so could it be possible my regex is wrong? </p>