我有
string = ":61:2002190219C45612.4S202EXCOL3654628815//CT56748005:86:/BENM/Unitech Imports/REM//58970.047:61:2002190219C30000S103LCADV5674920204//CT56748006:86:/BENM/Gravity Imports/REM//INV/FEB20/446301"
pattern = "61:[A-Za-z0-9 \/,\-_\.]{1,}:86:[A-Za-z0-9 \/\.\-]{1,}"
re.findall(pattern , string) # - > this is giving list with 2 element
但是当字符串中有“:”"61:[A-Za-z0-9 \/,\-_\.:]{1,}:86:[A-Za-z0-9 \/\.\-:]{1,}"时,我将正则表达式修改为,然后它在一个列表中给出完整的内容。
modified_string = ":61:2002190219C45612.4S202EXCOL:3654628815//CT56748005:86:/BENM/Unitech Imports/REM//58970.047:61:2002190219C30000S103LCAD:V5674920204//CT56748006:86:/BENM/Gravity Imports/REM//INV/FEB20/446301"
我尝试了多种选项,但无法获得所需的输出。
预期产出
re.findall(pattern,modified_string)
# => ['61:2002190219C45612.4S202EXCOL:3654628815//CT56748005:86:/BENM/Unitech Imports/REM//58970.047','61:2002190219C30000S103LCAD:V5674920204//CT56748006:86:/BENM/Gravity Imports/REM//INV/FEB20/446301' ]
慕工程0101907
MM们
相关分类