Reset the lastIndex property in String.match() and replace().