Note that this fails for regex containing lookahead.  I'm not sure if we want to do it now, but the eventual "correct" solution is to have "PrimitiveState" contain a method that returns whether it is nullable.  Then each implementation can determine that for itself.  For RegExState, we might just require the user to pass a flag to the constructor.