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
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