New submission from Sagar <[email protected]>:
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\"|\"3D\"', '', dat, re.I)
>>> type
('"10GE" "4x" "AMPC" "DOWN" "LU" "SFP+" "ether" "xe" "DOWN" "MPC" "BUILTIN"',
2)
>>> dat = '"10GE" "4x" "AMPC" "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\"|\"3D\"', '', dat, re.I)
>>> type
('"10GE" "4x" "AMPC" "SFP+" "ether" "xe" "DOWN" "MPC" "BUILTIN"', 2)
>>> dat = '"10GE" "4x" "AMPC" "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\"|\"3D\"', '', dat, re.I)
>>> type
('"10GE" "4x" "AMPC" "SFP+" "ether" "xe" "BUILTIN"', 2)
>>> dat = '"10GE" "4x" "AMPC" "SFP+" "ether" "xe" "BUILTIN"'
>>> type =
>>> re.subn(r'\"BUILTIN\"|\"B\d\"|\"I\d\"|\"LU\"|\"Trinity\"|\"Trio\"|\"DOWN\"|\"UNKNOWN\"|'
... r'^AND$|\"Q\"|\"MPC\"|\"EA\d\"|\"3D\"', '', dat, re.I)
>>> type
('"10GE" "4x" "AMPC" "SFP+" "ether" "xe" ', 1)
>>>
----------
components: Library (Lib)
messages: 332198
nosy: saga
priority: normal
severity: normal
status: open
title: re.sub is only replacing max. of 2 string found by regexp.
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35543>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com