perl /m

20 篇文章 30 订阅 ¥39.90 ¥99.00
本文介绍了Perl中/m修饰符的使用,它允许^和$匹配嵌入换行符前后的文本,使得在多行模式下进行有效的文本匹配。通过示例展示了/m如何在实际代码中应用。
摘要由CSDN通过智能技术生成
<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



                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

scan724

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值