PracticeDev/study_perl/re/6re.pl

19 lines
376 B
Perl
Raw Normal View History

2022-12-20 17:31:11 +08:00
#!/usr/bin/perl
$name="aAbBcCbB";
$_="aAbBcCbB";
print "------first--------\n";
if(/bB/){ # 匹配完第一个bB就结束
print "pre match: $` \n";
print "match: $& \n";
print "post match: $' \n";
}
print "------while--------\n";
while(/bB/g){ # 将迭代两次
print "pre match: $` \n";
print "match: $& \n";
print "post match: $' \n";
}