我有如下文字:
* Some text in a bullet list.
* Some more text in the same bullet list
Break my pattern with a random number of normal text.
That keeps going for some time
* Back to some text in a bullet list
* That goes on
我想制作一个正则表达式,能够提取项目符号列表中的所有连续行。例如,在我之前的示例中,我想选择以下内容:
Group 1
* Some text in a bullet list.
* Some more text in the same bullet list
Group 2
* Back to some text in a bullet list
* That goes on`
我尝试了多个正则表达式,但无法将提取限制为连续列表。例如,此正则表达式re.findall(r"\* +(.*+)", text)
将所有项目符号列表返回为单个组(但不要按连续的项目符号行进行拆分)