<pre name="code" class="html">[root@backoffice01 ~]# cat a1.pl
my $_="aa
2bb
3cc";
if ($_=~/aa$\n^2bb\n3cc/){print "1111111111\n"};
if ($_=~/aa\n^2bb\n3cc/m){print "2222222222\n"};
[root@backoffice01 ~]# perl a1.pl
2222222222
/m 当然多行处理
/m 修改荀彧^和$来立即匹配一个嵌入的换行前后
分别的,
/^=head[1-7]/m 会匹配模式不只是记录的开头,但任何地方在一个新行后
The /m modifier allows ^ and $ to match immediately before and after an embedded newline, respectively. /^=head[1-7]/m would match that pattern not just at the beginning of the record, but anywhere
right after a newline as well
perl /m
最新推荐文章于 2021-10-23 19:04:08 发布
本文介绍了Perl中/m修饰符的使用,它允许^和$匹配嵌入换行符前后的文本,使得在多行模式下进行有效的文本匹配。通过示例展示了/m如何在实际代码中应用。
摘要由CSDN通过智能技术生成