我想匹配模式可能有多个模式的实例的字符串。我需要单独的每个实例。 re.findall()
应该这样做,但我不知道我在做什么错。Python正则表达式匹配多次
pattern = re.compile('/review: (http://url.com/(\d+)\s?)+/', re.IGNORECASE)
match = pattern.findall('this is the message. review: http://url.com/123 http://url.com/456')
我需要 'http://url.com/123',并且http://url.com/456两个数123 & 456是match
列表的不同的元件。
我也试过'/review: ((http://url.com/(\d+)\s?)+)/'
作为模式,但没有运气。
只是删除回顾:部分作为第二HTTP不会有之前的数值。 – abc123
是的,但我需要那里,它是正则表达式的一部分。我不需要任何网址,只是字符串'审查:' – mavili