- 论坛徽章:
- 145
|
本帖最后由 jason680 于 2015-09-26 21:44 编辑
回复 1# sunzhiguolu
print them($1,$2,...) to understand it easily
$ perl -e '{$_=11223344;print "Match! \$1=$1,\$2=$2\n" if(m/\b(([0-9])\2)+4/)}'
Match! $1=33,$2=3
$ perl -e '{$_=11223344;print "Match! \$1=$1,\$2=$2,\$3=$3\n" if(m/\b((([0-9])\3)+)4/)}'
Match! $1=112233,$2=33,$3=3
BTW, about the \b
$ perl -e '{$_=311223344;print "Match! \$1=$1,\$2=$2,\$3=$3\n" if(m/\b((([0-9])\3)+)4/)}'
$ perl -e '{$_=311223344;print "Match! \$1=$1,\$2=$2,\$3=$3\n" if(m/((([0-9])\3)+)4/)}'
Match! $1=112233,$2=33,$3=3
|
评分
-
查看全部评分
|