【发布时间】:2012-04-13 00:19:13
【问题描述】:
需要提取开始和结束之间的所有内容。
如果没有\n,则以下代码有效。
$mystring = "The start text always precedes \n the end of the text.";
if($mystring =~ m/start(.*?)end/) {
print $1;
}
o/p 应该是 - 文本总是在 \n 之前
【问题讨论】:
标签: text-extraction
需要提取开始和结束之间的所有内容。
如果没有\n,则以下代码有效。
$mystring = "The start text always precedes \n the end of the text.";
if($mystring =~ m/start(.*?)end/) {
print $1;
}
o/p 应该是 - 文本总是在 \n 之前
【问题讨论】:
标签: text-extraction
研究perlre,尤其是/s 修饰符。
【讨论】: