给出例句:
the lady went to the coffe and bought a tea. then she drank the tea.
我正在尝试捕获以'the'开头,以'tea'结尾,中间还有'bought'的句子。
它看起来像这样:
(the)(.*)(bought)(.*)(tea)
问题在于,在 the 和购买这两个词之间没有另一个词 the 。在找到 tea 一词后,它也不应捕获句子的其余部分。
我提供的解决方案产生了结果:
the lady went to the coffe and bought a tea. then she drank the tea
但是我要寻找的是:
the coffe and bought a tea