zoukankan      html  css  js  c++  java
  • p{space}|p{Hex}|p{Digit}|转译符|1|g{-1}|[^ab]|/([^dD]+)/

    小骆驼 第七章 漫游正则表达式王国

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    $_ = 'ab   cde f ghijk10.x12ln';
    
    if(/d/){print "get!
    ";}
    
    if(/x/){print "get!
    ";}else{print "no match!
    "}
    
    if(/p{space}/){print "get!
    ";}else{print "no match!
    "}
    
    if(/p{Digit}/){print "get!
    ";}else{print "no match!
    "}
    
    if(/p{Digit}p{Hex}/){print "get!
    ";}else{print "no match!
    "}
    
    if(/P{Digit}p{Hex}/){print "get!
    ";}else{print "no match!
    "}
    
    if(/g.i/){print "get!
    ";}else{print "no match!
    "}
    
    if(/./){print "get!
    ";}else{print "no match!
    "}
    
    if(/\/){print "get!
    ";}else{print "no match!
    "}
    
    #get!
    #no match!
    #get!
    #get!
    #get!
    #get!
    #get!
    #get!
    #get!
    
    $_ = 'aaaabbiaaccdd1122';
    
    if(/(..)1/){print "$1
    ";}else{print "no match!
    "}
    
    if(/(..)1(.)2i1/){print "$1,$2
    ";}else{print "no match!
    "}
    
    if(/(.)1(.)211/){print "$1,$2
    ";}else{print "no match!
    "}
    
    if(/(.)1(.)g{-1}11/){print "$1,$2
    ";}else{print "no match!
    "}
    
    if(/(.)1(.)g{2}11/){print "$1,$2
    ";}else{print "no match!
    "}
    
    #aa
    #aa,b
    #no match!
    #c,d
    #c,d
    
    if(/([^ab]+)/){print "$1
    ";}else{print "no match!
    "}
    
    if(/([ab]+)/){print "$1
    ";}else{print "no match!
    "}
    
    if(/([^dD]+)/){print "$1
    ";}else{print "no match!
    "}
    
    #i
    #aaaabb
    #no match!
    
  • 相关阅读:
    三阶魔方公式
    XML解析GData、XMLParser
    xib_cell布局适配高度
    SizeClass
    Storyboard界面传值
    Masonry(第三方库)的使—代码实现屏幕适配
    UITableView
    AFNetworking网上加载数据及JSON解析
    UICollectionView
    OC面向对象-多态
  • 原文地址:https://www.cnblogs.com/yuanjingnan/p/11061474.html
Copyright © 2011-2022 走看看