Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用正则表达式匹配可能包含引号的句子&引用;_Python_Regex_Python 3.x_Findall - Fatal编程技术网

Python 使用正则表达式匹配可能包含引号的句子&引用;

Python 使用正则表达式匹配可能包含引号的句子&引用;,python,regex,python-3.x,findall,Python,Regex,Python 3.x,Findall,几天来,我一直在尝试编写一个正则表达式,它将捕获以特定字符串开头,以不允许的字符结尾的句子(怎么了 /starting string foo (.*)\</ /starting string foo(.*)给出一个示例字符串,向我们展示它匹配的内容,以及它应该匹配或不应该匹配的内容。完成,编辑成post,它可以工作,但似乎没有停止(只获取大字符串的整个剩余部分!)。好的,多亏了堆,它终于可以工作了。最后的代码是“starting string foo”[^我认为您可能实际上在寻找非贪婪匹

几天来,我一直在尝试编写一个正则表达式,它将捕获以特定字符串开头,以不允许的字符结尾的句子(怎么了

/starting string foo (.*)\</

/starting string foo(.*)给出一个示例字符串,向我们展示它匹配的内容,以及它应该匹配或不应该匹配的内容。完成,编辑成post,它可以工作,但似乎没有停止(只获取大字符串的整个剩余部分!)。好的,多亏了堆,它终于可以工作了。最后的代码是“starting string foo”[^我认为您可能实际上在寻找非贪婪匹配。请参阅此处并让我知道,我将修改我的答案
     starting string foo Hubble revisits the famous "pillars of creation" with a new lens <
    starting string foo Hubble revisits the famous
     starting string foo Buzz Aldrin's self-portrait during Gemini 12 with the Earth reflecting off his visor, 12 November 1966 [2651x2632] <
    starting string foo Buzz Aldrin's self-portrait during Gemini 12 with the Earth reflecting off his visor, 12 November 1966 [2651x2632]
/starting string foo (.*)\</