title: python, regular expressions, named groups and "logical or" operator
body: <p>In python regular expression, named and unnamed groups are both defined with '(' and ')'. This leads to a weird behavior. Regexp</p>
  
  <pre><code>"(?P&lt;a&gt;1)=(?P&lt;b&gt;2)"
  </code></pre>
  
  <p>used with text "1=2" will find named group "a" with value "1" and named group "b" with value "2". But if i want to use "logical or" operator and concatenate multiple rules, the following regexp:</p>
  
  <pre><code>"((?P&lt;a&gt;1)=(?P&lt;b&gt;2))|(?P&lt;c&gt;3)"
  </code></pre>
  
  <p>used with same text "1=2" will find an <strong>unnamed</strong> group with value "1=2". I understood that regexp engine treats "(" and ")" that encloses groups "a" and "b" as an unnamed group and reports that it is found. But i don't want an unnamed groups to be reported, i just want to use "|" in order to "glue" multiple regexps together. Without creating any parasitic unnamed groups. Is it a way to do so in python?</p>