Improve use of regular expressions in model processing.