这是一个例子:
a = "one two three four five six one three four seven two" m = re.search("one.*four", a)
我想要的是找到从"一"到"四"的子串,其中不包含子串"两".答案应该是:m.group(0)="一三四",m.start()= 28,m.end()= 41
有没有办法用一条搜索线做到这一点?
python regex
python ×1
regex ×1