title: c# regex match a group of characters that not repeates
body: <p>Inspired by other question here (I already accepted a non-regex solution)
  <a href="https://stackoverflow.com/questions/43498582/c-sharp-regex-match-set-of-characters-in-any-order-only-once">c# regex match set of characters in any order only once</a> </p>
  
  <p>But this solution from @Dmitry Egorov is by far more elegant and I am still struggling to solve it properly (if it can be solved with one regex)
  The closest I get is this one</p>
  
  <pre><code>^(.|\n)*&lt;\[SG (?!.*(.).*\2)[msbrelft]+\]&gt;(.|\n)*$
  </code></pre>
  
  <p>The text should match is as follows</p>
  
  <pre><code>ID-CFI Location 02h displays sector protection status for the sector selected by the sector address (SA) used in the ID-CFI enter
  command. To read the protection status of more than one sector it is necessary to exit the ID ASO and enter the ID ASO using the
  new SA. &lt;[SG sbl]&gt;
  Page mode read between ID locations other than 02h is supported.
  </code></pre>
  
  <p>I use in C# this check</p>
  
  <pre><code>if (!Regex.IsMatch(obj.Object_Text, format.Value))
  ...
  ...
  </code></pre>
  
  <p>In words, match should be:</p>
  
  <pre><code>- if this exists anywhere in text &lt;[SG sbl]&gt; including over \n or \r\n
  - letters should be in this group of letters [msbrelft]
  - must be minimum one letter, eg. &lt;[SG s]&gt;
  - can be up to all from group, eg. &lt;[SG sbl]&gt;
  - must be only one letter (no duplicates), eg. &lt;[SG sbsl]&gt; is NOT good
  </code></pre>
  
  <p>I don't want to extract group, just validate all text if contain &lt;[SG xx..]> with previous explained rules.</p>
  
  <p>Now what I already come up and drove me crazy, was </p>
  
  <pre><code>^(.|\n)*&lt;\[SG (?!.*(.).*\2)[msbrelft]+\]&gt;(.|\n)*$
  </code></pre>
  
  <p>which don't validate if AFTER my interesting group there are two letters ON THE SAME LINE (no \r\n or \n).</p>
  
  <p>So for example this works (there is a \n or \r\n after group)</p>
  
  <pre><code>ID-CFI Location 02h displays sector protection status for the sector selected by the sector address (SA) used in the ID-CFI enter
  command. To read the protection status of more than one sector it is necessary to exit the ID ASO and enter the ID ASO using the
  new SA. &lt;[SG sbl]&gt;
  Page mode read between ID locations other than 02h is supported.
  </code></pre>
  
  <p>and this not (two spaces after my group)</p>
  
  <pre><code>ID-CFI Location 02h displays sector protection status for the sector selected by the sector address (SA) used in the ID-CFI enter
  command. To read the protection status of more than one sector it is necessary to exit the ID ASO and enter the ID ASO using the
  new SA. &lt;[SG sbl]&gt;  Page mode read between ID locations other than 02h is supported.
  </code></pre>
  
  <p>Any help will be greatly appreciated!
  Thank you.</p>