use strict;
my $str = '租赁期开始日,本公司对租赁确认使用权资产和租赁负债
租赁期开始日,对租赁确认使用权资产和租赁负债
本公司对租赁确认使用权资产和租赁负债。
本集团在租赁期开始日对租赁确认使用权资产和租赁负债
公司对租赁确认使用权资产和租赁负债
本公司对租赁确认使用权资产和租赁负债
本公司对租赁确认使用权资产和租赁负债
在租赁期开始日,本公司对租赁确认使用权资产和租赁负债
在租赁期开始日,公司对租赁确认使用权资产和租赁负债。
在租赁期开始日,公司对租赁确认使用权资产和租赁负债
本公司选择确认使用权资产和租赁负债,
本公司对租赁确认使用权资产和租赁负债。
对租赁确认使用权资产和租赁负债
本公司对租赁确认使用权资产和租赁负债。
确认使用权资产和租赁负债
本集团对租赁确认使用权资产和租赁负债
确认为使用权资产,确认为租赁负债
本公司对租赁确认使用权资产和租赁负债
在租赁期开始日,公司对租赁确认使用权资产和租赁负债
公司租入资产所支付的租赁费,在不扣除免租期的整个租赁期内,按直线法进行分摊,计入当期费用
在租赁期开始日,公司对租赁确认使用权资产和租赁负债
在租赁期开始日,公司对租赁确 认使用权资产和租赁负债
在租赁期开始日,本公司对租赁确认使用权资产,确认租赁负债。
在租赁期开始日,公司对租赁确认使用权资产和租赁负债
本集团在租赁期开始日对租赁确认使用权资产,租赁负债
在租赁期开始日,公司对租赁确认使用权资产和租赁负债。
';
my $regex = qr/(租赁)?.{0,9}确认(为)?使用权资产/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html