title: How do I use format() in re.compile
body: <p>I want to write a regex that orders python to return items in a list that have sequence of vowels, defined by <code>len=2</code>. </p>
  
  <pre><code>&gt;&gt;&gt; chars = "aeiou"
  &gt;&gt;&gt; len = 2
  &gt;&gt;&gt; regex = re.compile(r"[+{}+]{{len}}",format(chars))
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py", line 234, in compile
      return _compile(pattern, flags)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py", line 286, in _compile
      p = sre_compile.compile(pattern, flags)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sre_compile.py", line 764, in compile
      p = sre_parse.parse(p, flags)
    File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sre_parse.py", line 930, in parse
      p = _parse_sub(source, pattern, flags &amp; SRE_FLAG_VERBOSE, 0)
  TypeError: unsupported operand type(s) for &amp;: 'str' and 'int'
  &gt;&gt;&gt; 
  &gt;&gt;&gt; def funct(regex,list):
  ...     for item in list:
  ...         if regex.search(item):
  ...             print(item)
  ... 
  &gt;&gt;&gt; list = ['avid','Chaos','st','Cy']
  &gt;&gt;&gt; 
  &gt;&gt;&gt; funct(regex,list)
  avid
  Chaos
  </code></pre>
  
  <p>I should be only getting <code>Chaos</code>, not <code>avid</code>. I'm having trouble understanding inputting <code>len</code> parameter into the <code>re.compile</code> module.</p>