title: Best Way to Create a Class That Returns Commands on Regex Matches
body: <p>I have a bot that responds to user input, but before selecting what to do, it needs to run the string through Regex and select the appropriate command based on whether a match is successful. For example,</p>
  
  <pre><code>if (Regex.Match(...,.....).Success)
  {
  // Do #1
  }
  else if (Regex.Match(...,.....).Success)
  {
  // Do #2
  }
  </code></pre>
  
  <p>This is not scalable or maintainable anywhere above 5 potential regex matches. What's a way to design a class that can step in to solve this for me? </p>
  
  <p>Maybe a class called <code>CommandDictionary</code> that scans the strings for a match, generates a list of commands that corresponds to each successful regex match, and then picks the command that is associated with the highest priority? For example, if "Hello" matches "Greet" and "Ignore", but "Greet" has higher priority, the response will be Do Greet.</p>