使用 Perl 从多行字符串中提取文本 [英] Extract text from a multiline string using Perl
本文介绍了使用 Perl 从多行字符串中提取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含多行的字符串.我需要提取两个字符串之间的文本.例如:
I have a string that covers several lines. I need to extract the text between two strings. For example:
Start Here Some example
text covering a few
lines. End Here
我需要提取字符串,从这里开始一些覆盖几行的示例文本.
我该怎么做?
推荐答案
print $1 if /(Start Here.*?)End Here/s;
这篇关于使用 Perl 从多行字符串中提取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文