title: Regexp & Grafana: exclusions and string cut
body: <p>I'm using Grafana and Prometheus to create some graphs, but this I believe is fundamentally a regexp (RE2?) question. I am dynamically creating a list of elements and populating a Variable (Query of <code>label_values(source)</code> where "source" contains the list of possible results).  The query returns a list like this:</p>
  
  <pre><code>udr_foo
  udr_owls
  dns-baz1
  dns-baz399
  rpz_c_1.donotuse
  rpz_c_1.memosis
  rpz_c_1.argylesocks
  rpz_c_1.argylesocks3
  rpz_c_1.argylesocks_http2
  </code></pre>
  
  <p>I cannot modify the data in the database; I must trim it down with regexp. Currently, I have this RE2 regexp that I bodged together that I apply to the list to do some exclusions:</p>
  
  <p><code>/^(?!dns|udr|rpzlog_c_1.donotuse).*/</code></p>
  
  <p>This gives me as a result that is partially useful, because it excludes the results I don't want:</p>
  
  <pre><code>rpz_c_1.memosis
  rpz_c_1.argylesocks
  rpz_c_1.argylesocks3
  rpz_c_1.argylesocks_http2
  </code></pre>
  
  <p>Question: <strong>How would I modify that regular expression so it gives me a more concise result set by also stripping the leading "rpz_c_1." string component?</strong> As this is embedded in the Grafana tool, I cannot "pipe" multiple regexp instantiations together with a shell - I only get one regexp opportunity to modify the results. This is the set of results that I would like to have returned:</p>
  
  <pre><code>memosis
  argylesocks
  argylesocks3
  argylesocks_http2
  </code></pre>
  
  <p>My regexp probably is awful. A more concise way of looking at this might be:</p>
  
  <ul>
  <li>return all results that contain "rpz_c_1." as the start of the string</li>
  <li>EXCEPT for any containing the string "donotuse"</li>
  <li>then strip "rpz_c_1." from the beginning of each string</li>
  </ul>