[issue35543] re.sub is only replacing max. of 2 string found by regexp.

2018-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The third argument of re.sub() is the maximal number of replacements. re.I == 2. sub(pattern, repl, string, count=0, flags=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replace

[issue35543] re.sub is only replacing max. of 2 string found by regexp.

2018-12-20 Thread Sagar
New submission from Sagar : Below are the logs: >>> dat = '"10GE" "4x" "AMPC" "B3" "BUILTIN" "DOWN" "LU" "SFP+" "ether" "xe" >>> "DOWN" "MPC" "BUILTIN"' >>> type = >>> re.subn(r'\"BUILTIN\"|\"B\d\"|\"I\d\"|\"LU\"|\"Trinity\"|\"Trio\"|\"DOWN\"|\"UNKNOWN\"|' ... r'^AND$|\"Q\"|\"MPC\"|\"EA\d