Use regexes instead of custom heuristics