Changed function in ndiff to use regular expressions