0
我試圖創建一個正則表達式來檢測降價引用塊。
這是迄今爲止我正則表達式:正則表達式匹配多個空格,直到一個字符
(?:^|\n)[ \t]*(>[ \t]*\S(?:(?!\n(\s*\n)+[^>])[\s\S])*)
(?:^|\n) beginning of string, or a line break
[ \t]* optional spaces
>[ \t]*\S `>` followed by optional spaces and at least one character
(... [\s\S])* capture any following character\white-space multiple times
(?!\n(\s*\n)+[^>]) stop capture if next following characters are
at least 2 line breaks mixed with other white-spaces
followed by anything but `>`
一切工作正常,除了負前瞻:如果遇到超過2個換行符捕獲停止。
Regex101向我顯示4個匹配,當我想3.任何指針?
你您正則表達式的描述不符實際的正則表達式。具體來說,描述中的最後一行有一個「+」,它在實際的正則表達式中不存在。 –