only process cr if it's found

because re.sub is crazy slow.
Merge pull request #5576 from minrk/re.sub-is-crazy-slow

only process cr if it's found