谁能帮我从以下几行中匹配From和Subject的第一次出现之间的文本,
输入
Random Line 1
Random Line 2
From: person@example.com
Date: 01-01-2011
To: friend@example.com
Subject: This is the subject line
Random Line 3
Random Line 4
Subject: This is subject
This is the end
输出
From: person@example.com
Date: 01-01-2011
To: friend@example.com
Subject: This is the subject line
我尝试使用以下正则表达式,
/(From:.*(?i)Subject:.*?)\n/m
上面的正则表达式选择直到最后一个主题