我有一个正则表达式,用于搜索换行符:
\r?\n|\r
以下是两个例子:
#Example-1#
The correct answer is (B) 2 to 3. jfbgfdgdf sgdsgsd.
jfbgfdgdf sgdsgsd.
#End Example-1#
#Example-2#
The correct answer is (B) 2 to 3. jfbgfdgdf sgdsgsd.
jfbgfdgdf sgdsgsd.
#End Example-2#
演示:https://regex101.com/r/zQ3nR3/1
我需要更新一个正则表达式,使其仅找到多个换行符的实例,比如在Example-1中文本行之间出现的换行符,而不是在Example-2中文本行之间出现的那个换行符。
(\r?\n|\r){2,}
吗? - Wiktor Stribiżew\\s{2,}
。它只会查找两个或更多个空格的实例。 - SomeJavaGuy