Some minor improvements to the regex handler