SearchContext: fix regex-error and regex-state consistency