Bug 965712: Part 1 - Use our string matching logic for regexps when possible, r=luke