zoukankan      html  css  js  c++  java
  • perl /m修饰符使用说明

    高级用法;
    多行匹配:
    
    grok正则和普通正则一样, 默认是不支持匹配回车换行的。
    
    
    perl的/m选项
    
    The /m modifier allows ^ and $ to match immediately before and after an embedded newline, 
    
    
    respectively. /^=head[1-7]/m would match that pattern not just at the beginning of the record, but anywhere right after a newline as well.
    
    
    
    /m 修饰符允许 ^和$来立即匹配之前和之后的一个嵌入式的换行,
    
    分别的. /^=head[1-7]/m 会匹配 模式不只是在记录的开始,但是任何地方在一个新行之后
    
    
    [tomcat@wx02 test]$ cat a3.pl 
    my $str="=head1
    abc
    2";
     if ($str =~/^=head[1-7]
    abc
    2/m){print "1111111111
    "};
    [tomcat@wx02 test]$ perl a3.pl 
    1111111111
    
    
    m 是将字符串作为多行处理,s是将字符串作为单行处理,如果是s在字符串中出现的
    就相当于普通字符。
    
    m将串视为多行
    o只赋值一次
    s将串视为单行

  • 相关阅读:
    javascript 数字格式化
    spring-cloud blogs
    rabbitmq python
    centos7下 安装mysql
    hue install
    d3 document
    elastichq 离线安装
    elasticsearch agg
    elastichq auto connect
    Go Hello World!
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350391.html
Copyright © 2011-2022 走看看