add character class support
should check lo <= hi after trimming the lower bits.
refactor.