title: How can I match namespace prefixes with regular expression
body: <p>What I really want to do is to match all namespace prefixes both for tags and attributes by using a regular expression.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;foo:person bar:id="43"&gt;
    text text &lt;nomatch:free text
    &lt;baz:name&gt;
      text nomatch:free&gt; text
    &lt;/baz:name&gt;
      text nomatch:free="44" text
      &lt;age bae:years="44" /&gt;
      text
  &lt;/foo:person&gt;
  </code></pre>
  
  <p>What I want is to extract only the following prefixes: foo, baz, bad, bae, bar</p>
  
  <p>I cannot find a regular expression for implementing this.</p>
  
  <p>Please take account that the regular expression should not have hardcoded the names foo, baz, bad, bae, bar...</p>