• Perl 单词边界


    单词边界:
    
    匹配单词边界,就是位于单词(w)和非单词字符(W)之间的零宽度的地方。
    
    就是单词前后必须跟非单词字符
    
    [oracle@jhoa big]$ cat 11.pl 
    #$var = "The Great Fred";
    $var = "Fred erick the Great";
    if ($var =~/Fred/){print "$var
    "};
    
    
    [oracle@jhoa big]$ perl 11.pl 
    Fred erick the Great
    
    [oracle@jhoa big]$ cat 11.pl 
    #$var = "The Great Fred";
    $var = "aFred erick the Great";
    if ($var =~/Fred/){print "$var
    "};
    [oracle@jhoa big]$ perl 11.pl 
    [oracle@jhoa big]$ 
    
    Fred前面出现单词字符 ,匹配不上
    
    [oracle@jhoa big]$ cat 11.pl 
    #$var = "The Great Fred";
    $var = "Freda erick the Great";
    if ($var =~/Fred/){print "$var
    "};
    [oracle@jhoa big]$ perl 11.pl 
    [oracle@jhoa big]$
    
    Fred后面出现单词字符匹配不上 
    
    [oracle@jhoa big]$ cat 11.pl 
    #$var = "The Great Fred";
    $var = "!Fred erick the Great";
    if ($var =~/Fred/){print "$var
    "};
    [oracle@jhoa big]$ perl 11.pl 
    !Fred erick the Great
    [oracle@jhoa big]$
    
    单词前面出现非单词字符,可以匹配
    
    [oracle@jhoa big]$ cat 11.pl 
    #$var = "The Great Fred";
    $var = "Fred! erick the Great";
    if ($var =~/Fred/){print "$var
    "};
    [oracle@jhoa big]$ perl 11.pl 
    Fred! erick the Great
    [oracle@jhoa big]$
    
    单词后面出现非单词字符,可以匹配

  • 相关阅读:
    特征的处理
    Pandas读取文件
    标准化数据-StandardScaler
    hibernate 继承映射
    hibernate 多对多关联映射
    hibernate 一对一关联映射
    hibernate 一对多 单双向关联
    hibernate配置文件
    spring整合struts2
    AWS云教育账号创建以及搭建数据库
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351977.html
Copyright © 2020-2023  润新知