我在 javascript 中有一个类似的文本
some text
- list
- list
- list
more text
- another list
- another list
- another list
如何匹配以字符
-
开头的所有行,直到某行不以该字符开头?- list
- list
- list
和
- another list
- another list
- another list
我尝试使用正则表达式
/^(-.*\n-.*|$)/gm
,但仅当列表包含偶数个元素时才有效,而我需要它适用于任意数量的元素。