I need to strip control codes before checking.

Use the S switch, see versions.txt section 123 for details.