分割两个单引号之间的内容,且不重复分割已使用的单引号
废话少说,直接上干货:
import re
result = re.findall("'([^']*)'", string) #将string替换为你需要分割的部分
示例代码:
string = "'jmp qword ptr [rip + 0x220882]', 'jmp qword ptr [rip + 0x220832]', 'jmp qword ptr [rip + 0x220822]'"
result = re.findall("'([^']*)'", string)
print(result)
输出的 result 为 list 类型,result 为:
['jmp qword ptr [rip + 0x220882]',
'jmp qword ptr [rip + 0x220832]',
'jmp qword ptr [rip + 0x220822]']
可以看到字符串被很好的分割了,且不会出现 ’, ’ 的分割情况