正则表达式 - 如何 select 从模式到列表末尾的所有行

Regex - how to select all lines from a pattern to end of list

是否可以选择从最后一个 "Jhon Gerome" 匹配项(底部匹配项)到列表末尾的所有行?是剪贴板文本,我使用.Net Regex。

[2/3/2015 4:51:27 PM] *** Call to Bob Robinson ***
[2/3/2015 4:52:51 PM] Bob Robinson: check this out
[2/3/2015 4:55:34 PM] *** Call ended, duration 04:06 ***
[2/9/2015 7:52:58 PM] Jhon Gerome: you take to long
[2/25/2015 4:05:25 PM] Jhon Gerome: I am reading
[2/25/2015 4:05:26 PM] Jhon Gerome: ok
[3/10/2015 11:17:27 PM] Bob Robinson: how are you?
[3/10/2015 11:17:35 PM] Jhon Gerome: fine thanks
[3/10/2015 11:17:41 PM] Bob Robinson: are you there?
[3/10/2015 11:17:41 PM] Bob Robinson: can you hear me?
[2/25/2015 4:23:23 PM] *** Call from Bob Robinson ***
[2/25/2015 5:36:38 PM] *** Call ended, duration 1:13:15 ***
[3/10/2015 11:16:46 PM] *** Call to Bob Robinson, no answer.
Send video message ***
[3/10/2015 11:18:11 PM] Bob Robinson: whats up man
[3/10/2015 11:20:32 PM] Bob Robinson: Jhon?
[3/10/2015 11:20:32 PM] Bob Robinson: are you there?

请注意所有这些行都以 CRLF 结尾。现在我首先要做的是匹配...

fine thanks
[3/10/2015 11:17:41 PM] Bob Robinson: are you there?
[3/10/2015 11:17:41 PM] Bob Robinson: can you hear me?
[2/25/2015 4:23:23 PM] *** Call from Bob Robinson ***
[2/25/2015 5:36:38 PM] *** Call ended, duration 1:13:15 ***
[3/10/2015 11:16:46 PM] *** Call to Bob Robinson, no answer.
Send video message ***
[3/10/2015 11:18:11 PM] Bob Robinson: whats up man
[3/10/2015 11:20:32 PM] Bob Robinson: Jhon?
[3/10/2015 11:20:32 PM] Bob Robinson: are you there?

到目前为止使用此代码实现:(?s).*Jhon Gerome(\1) 感谢 "Fede"

但是我会找到 >>>Bob Robinson: <<< 之后的所有内容所以我想以这样的结尾,它只在一行中并不重要。

are you there?
can you hear me?
whats up man
Jhon?
are you there?

是否可以用一个正则表达式代码实现这一点?或最多两个?任何指针?谢谢。

您可以使用带有 s 标志的正则表达式:

.*Jhon Gerome(.*)

Working demo

MATCH 1
1.  [385-852]   `: fine thanks
[3/10/2015 11:17:41 PM] Bob Robinson: are you there?
[3/10/2015 11:17:41 PM] Bob Robinson: can you hear me?
[2/25/2015 4:23:23 PM] *** Call from Bob Robinson ***
[2/25/2015 5:36:38 PM] *** Call ended, duration 1:13:15 ***
[3/10/2015 11:16:46 PM] *** Call to Bob Robinson, no answer.
Send video message ***
[3/10/2015 11:18:11 PM] Bob Robinson: whats up man
[3/10/2015 11:20:32 PM] Bob Robinson: Jhon?
[3/10/2015 11:20:32 PM] Bob Robinson: are you there?`

或者你也可以使用内联标志:

(?s).*Jhon Gerome(.*)

那你就要抓取抓包组内容了