我想从字符串中过滤一些子字符串:
.
.
th>Di, -12 ;0907<th
th>Mi, -44 ;1007<th
th>Do, -66 ;1107<th
.
.
我的 perl 脚本是:
.
.
my (@d,$h,$s);
@d=$h=~/(th>(Di|Mi|Do), -\d\d ;\d\d\d\d<th)/igs;
foreach $s (@d)
{print "$s\n";};
Output is:
th>Di, -12 ;0907<th
Di
th>Mi, -44 ;1007<th
Mi
th>Do, -66 ;1107<th
Do
我的问题,我需要这个输出:
th>Di, -12 ;0907<th
th>Mi, -44 ;1007<th
th>Do, -66 ;1107<th
如何在正则表达式中过滤匹配项而不进行替换?