\s+(?<request_time>\d+(?:\.\d+)?)\s+ 解释
来源:互联网 发布:tidb 源码 编辑:程序博客网 时间:2024/04/28 23:57
<pre name="code" class="html"><pre name="code" class="html">看elk 看到一个正则;\s+(?<request_time>\d+(?:\.\d+)?)\s+回顾下:(?:pattern) 匹 配 pattern 但不获取匹配结果,也就是说这是一个非获取匹配,不进行存储供以后使用。这在使用 “或” 字符 (|) 来组合一个模式的各个部分是很有用。例如, ‘industr(?:y|ies) 就是一个比 ‘industry|industries’ 更简略的表达式。表示括号只是起分隔作用,不将括号中匹配的内容存入内存中因为如果不加?:的话,括号内匹配的内容会放入$1,$2...这些变量中1、命名分组格式为(?<grp name>),反向引用时用\k<grp name>2、命名分组的匹配的结果存在在变量%+变量中,取命名分组值,$+{grp name}.[tomcat@wx02 test]$ cat a2.pl my $str="456.123a";if ($str=~/\d+(\.\d+)/){print "\$1 is $1\n"};[tomcat@wx02 test]$ perl a2.pl $1 is .123[tomcat@wx02 test]$ cat a2.pl my $str="456.123a";if ($str=~/\d+(\.\d+)?/){print "\$1 is $1\n"};[tomcat@wx02 test]$ perl a2.pl $1 is .123\d+(\.\d+)? 中的?有什么用呢?x? 匹配 0 次或一次 x 字符串 [tomcat@wx02 test]$ cat a2.pl my $str="456";if ($str=~/\d+(\.\d+)?/){print "\$1 is $1\n"};[tomcat@wx02 test]$ perl a2.pl $1 is [tomca这里的(\.\d+)? 就是0次或者1次zjtest7-frontend:/root/test# cat a1.pl my $str="456.123a";if ($str=~/\d+(?:\.\d+)?/){print "\$1 is $1\n"};zjtest7-frontend:/root/test# perl a1.pl $1 is
0 0
- \s+(?<request_time>\d+(?:\.\d+)?)\s+ 解释
- perl 正则捕获 /(?<request_time>\d+(?:\.\d+)?)\s+/
- d's'f's'd
- s'd's
- s'd'f's'f's'd
- D-S证据理论
- &((struct s *) 0)->d
- d gsg s
- file-s-d
- %d %f %c %s
- D - Sloth's Angry
- a's'd
- d-s证据理论
- a's'd'f
- D-S证据理论
- S D I O S P I
- android 字符串%s、%1$s、%d、%1$d的使用
- S.O.D.A.是什么
- 牛客网答题笔记---构造回文
- 用二进制文件处理学生成绩
- 关于FileInputStreat和FileOutStreat进行将一个文件的字符复制到另一个文件中
- shareSDK实现QQ第三方分享
- PHP面向对象的程序设计多态--php高级最详细教程
- \s+(?<request_time>\d+(?:\.\d+)?)\s+ 解释
- MySQL Optimization Part 1 - Table Design
- Cas单点登录学习笔记
- 关于Verilog HDL中阻塞与非阻塞赋值形象理解
- linux下使用 qextserialport 编写串口程序
- RecyclerView、CardView和Palette打造炫酷流式布局效果
- Android性能优化典范之多线程篇
- 立体泪组共有的抽象类
- http://bbs.csdn.net/topics/390356059