More improvements for regular expressions