title: In Ansible, how to filter a dictionary based on regex pattern on the keys?
body: <p>I need to extract a subset of a dictionary based on a pattern on the key names.
  For example, in the v below I need to extract the key->values section1*. </p>
  
  <p>The code below assigns the list of values, but I still haven't found a way to preserve the key->map setting.</p>
  
  <pre><code>  - set_fact:
        v:
          section1_1: true
          section1_2: false
          section2_1: true
          section2_2: false
          section3: true
  
    - set_fact:
        v2: "{{ v | select('match','^section1_.*') | map('extract', v) | list }}"
  
    - debug:
        var: v2
  </code></pre>
  
  <p>Any help, please?
  Thanks.</p>