title: How to implement regular expression NFA with character ranges?
body: <p>When you read such posts as <a href="http://blog.drennuz.com/regex-nfa-and-thompsons-algorithm/" rel="noreferrer">Regex: NFA and Thompson's algorithm</a> everything looks rather straightforward until you realize in real life you need not only direct characters like "7" or "b", but also:</p>
  
  <pre><code>[A-Z]
  [^_]
  .
  </code></pre>
  
  <p>namely character classes (or ranges). And thus my question -- how to build NFA using character ranges? Using meta-characters like "not A", "anything else" and then computing overlapping ranges? This would lead to using tree-like structure when using final automaton, instead of just a table.</p>
  
  <p><strong>Update:</strong> please assume non-trivial in size (>>256) alphabet.</p>
  
  <p><em>I am asking about NFA, but later I would like to convert NFA to DFA as well.</em></p>