title: How to make a Rule String which states if another String is allowed returning a Boolean
body: <p>I have run into an interesting problem, I already have 2 working solutions however 1 of them is incredibly slow, and the other is incredibly limited.
  I'm trying to brainstorm ideas on how to solve this problem Efficiently while also being as flexible as possible. I was hoping someone may have some ideas on how to go about this since I'm completely stumped.</p>
  <p>I have a name, let's say I have some strings: &quot;A&quot; &quot;B&quot; &quot;C&quot; &quot;TEST&quot; and so on.</p>
  <p>Then I have another string let's say... &quot;(A OR TEST) AND B NOT C&quot; or something along that line.</p>
  <p>Now I need to make a Function where I can feed the second string alongside one of the first, and return a Boolean.</p>
  <p>So:</p>
  <pre><code>Function(InputString, RulesString)
      return RulesString Allows InputString
  
  Call Function(&quot;C&quot;, &quot;A OR TEST OR B NOT C&quot;) - Would return False as the RuleString doesn't allow C
  
  Call Function(&quot;A&quot;, &quot;A OR TEST OR B NOT C&quot;) - Would return True as A is allowed alongside TEST and B
  
      
  </code></pre>
  <p>The challenge is performance, I need something that's as efficient as possible since this is being called VERY often.</p>
  <p>My first, super cheap easy solution was a Hashset
  And doing</p>
  <pre><code>Function(InputString, Hashset)
      return Hashset.contains(InputString)
  </code></pre>
  <p>Obviously, this doesn't solve the issue, it's performant and does the basic idea. However, I need more flexibility than that.</p>
  <p>My second solution was significantly more complicated and took up roughly 20% of CPU Usage.
  But did cover all the cases I needed however it was TOO complicated and too costly.</p>
  <p>As a Side note, I'm using c#.</p>