YUANya

导航

 
 1 小骆驼 第八章 用正则表达式进行匹配
 2 
 3 #!/usr/bin/envperl
 4 
 5 use strict;
 6 use warnings;
 7 
 8 $_ ="#adchbehnyhme3534f\nvdh5ejbnv                _+IHG\n";
 9 
10 if(m%(a)%){print "$1\n";}else{print "no match!\n";}
11 
12 if(/(i)/i){print "$1\n";}else{print "no match!\n";}
13 
14 if(/ad(.*)5e/s){print "$1\n";}else{print "no match!\n";}
15 
16 if(/     j(.*)v/x){print "$1\n";}else{print "no match!\n";}
17 
18 if(/    (.?)/sx){print "$1\n";}else{print "no match!\n";}
19 
20 if(/\#(.*)/){print "$1\n";}else{print "no match!\n";}
21 
22 #a
23 #I
24 #chbehnyhme3534f
25 #vdh
26 #bn
27 #
28 #adchbehnyhme3534f

 

posted on 2019-06-19 23:57  YUANya  阅读(645)  评论(0编辑  收藏  举报