I\'m having a problem with a regex I created. My company searches for errors in an error file and tries to match the file to a set of possible strings. If one of the strings
You can use the parameter count within the re.subn function. This is to indicate the maximum number of replacements to be done.
re.subn
number_of_errors = re.subn( r"(is a duplicate for this vendor|Duplicate transaction detected)", "", string, count = 1)[1]