apply the same avoidance of the backtracking regex to the autodetect logic