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!
    
  • 相关阅读:
    Laravel路由除了根目录全报404错误
    jQuery源码分析之整体框架
    JS进阶系列之this
    JS进阶系列之原型、原型链
    原生JavaScript实现的贪吃蛇
    html文档流和事件流
    (转)mysql执行计划分析
    (转)重定向和转发区别
    el表达式取值优先级
    (转)性能测试基本指标
  • 原文地址:https://www.cnblogs.com/yuanjingnan/p/11061474.html
Copyright © 2011-2022 走看看