我有一个这样的字符串 - :
st = "url=these,url=are,url=test,url=questions"
Run Code Online (Sandbox Code Playgroud)
现在从这个字符串我需要生成所有的值url.现在正在使用的正则表达式是这样的:
import re
re.findall(r'([^\(url=\)]+)',st)
Run Code Online (Sandbox Code Playgroud)
现在我想要的输出是['these,', 'are,', 'test,', 'questions']但我的正则表达式
['these,', 'a', 'e,', 'test,', 'q', 'estions']将此作为输出.
那么,应该是我修改的正则表达式以及为什么我的正则表达式没有给我所需的输出.
你可能想要下一个:
>>> re.findall(r'url=(\w+)',st)
['these', 'are', 'test', 'questions']
Run Code Online (Sandbox Code Playgroud)