The replace function returns the new string with the replaces, but if there weren\'t any words to replace, then the original string is returned. Is there a way to k
As a workaround you can implement your own callback function that will set a flag and do the replacement. The replacement argument of replace can accept functions.