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

#!/usr/bin/perl

use strict;
use warnings; $_ = 'ab \ cde f ghijk10.x12ln'; if(/d/){print "get!\n";} if(/x/){print "get!\n";}else{print "no match!\n"} if(/\p{space}/){print "get!\n";}else{print "no match!\n"} if(/\p{Digit}/){print "get!\n";}else{print "no match!\n"} if(/\p{Digit}\p{Hex}/){print "get!\n";}else{print "no match!\n"} if(/\P{Digit}\p{Hex}/){print "get!\n";}else{print "no match!\n"} if(/g.i/){print "get!\n";}else{print "no match!\n"} if(/\./){print "get!\n";}else{print "no match!\n"} if(/\\/){print "get!\n";}else{print "no match!\n"} #get!
#no match!
#get!
#get!
#get!
#get!
#get!
#get!
#get! $_ = 'aaaabbiaaccdd1122'; if(/(..)\1/){print "$1\n";}else{print "no match!\n"} if(/(..)\1(.)\2i\1/){print "$1,$2\n";}else{print "no match!\n"} if(/(.)\1(.)\211/){print "$1,$2\n";}else{print "no match!\n"} if(/(.)\1(.)\g{-1}11/){print "$1,$2\n";}else{print "no match!\n"} if(/(.)\1(.)\g{2}11/){print "$1,$2\n";}else{print "no match!\n"} #aa
#aa,b
#no match!
#c,d
#c,d if(/([^ab]+)/){print "$1\n";}else{print "no match!\n"} if(/([ab]+)/){print "$1\n";}else{print "no match!\n"} if(/([^\d\D]+)/){print "$1\n";}else{print "no match!\n"} #i
#aaaabb
#no match!

\p{space}|\p{Hex}|\p{Digit}|转译符|\1|\g{-1}|[^ab]|/([^\d\D]+)/的更多相关文章

  1. java中转译符用"\\"的几种特殊字符

    在使用split的方法进行分隔时,要对这几种特殊字符进行"\\"分隔 | * ^ : . 1."|" 示例: String[] splitAddress=add ...

  2. 转译符,re模块,random模块

    一, 转译符 1.python 中的转译符 正则表达式中的内容在Python中就是字符串 ' \n ' : \ 转移符赋予了这个n一个特殊意义,表示一个换行符 ' \ \ n' :  \ \  表示取 ...

  3. JavaScript中的转译符

    转译字符 含义     \o NUL字符(\u0000) \b 退格符(\u0008) \t 水平制表符(\u0009) \n 换行符(\u000A) \v 垂直制表符(\u000B) \f 换页符( ...

  4. Linux-编译器gcc/g++编译步骤

    gcc和g++现在是gnu中最主要和最流行的c&c++编译器.g++是c++的命令,以.cpp为主:对于c语言后缀名一般为.c,这时候命令换做gcc即可.编译器是根据gcc还是g++来确定是按 ...

  5. Cognition math based on Factor Space (2016.05)

    Cognition math based on Factor Space Wang P Z1, Ouyang H2, Zhong Y X3, He H C4 1Intelligence Enginee ...

  6. C#对HTML转译需要注意的问题

    在做B/S程序时我们多少会用到一点HTML特殊符号转译. 如:“&”——>“&” , "<"——>"<" , " ...

  7. input框内的单引号,双引号转译

    主要是在后台传前端之前先把变量值替换单引号双引号成转译付. $bianlian是要替换的变量 两种方法 1.php后台输出值先转译 //双引号替换成转译符 $bianlian=preg_replace ...

  8. System and method for critical address space protection in a hypervisor environment

    A system and method in one embodiment includes modules for detecting an access attempt to a critical ...

  9. Latin1的所有字符编码

    ISO-8859-1 (ISO Latin 1) Character Encoding Contents The characters at a glance Character codes and ...

随机推荐

  1. D3.js 线段生成器 (V3版本)

    线段生成器 与线段生成器相关的方法: d3.svg.line() //创建一个线段生成器.   line(data) //使用线段生成器绘制data数据.   line.x([x]) //设置或获取线 ...

  2. 【Tip】JavaScript

    『JavaScript』 『引用网络资源』 JQuery <script src="http://code.jquery.com/jquery-latest.js">& ...

  3. Luogu P1607 庙会班车【线段树】By cellur925

    题目传送门 据说可以用贪心做?算了算了...我都不会贪.... 开始想的是用线段树,先建出一颗空树,然后输进区间操作后就维护最大值,显然开始我忽视了班车的容量以及可以有多组奶牛坐在一起的信息. 我们肯 ...

  4. Helvetic Coding Contest 2017 online mirror (teams allowed, unrated) M

    Description The marmots have prepared a very easy problem for this year's HC2 – this one. It involve ...

  5. 解题报告:hdu 3572 Task Schedule(当前弧优化Dinic算法)

    Problem Description Our geometry princess XMM has stoped her study in computational geometry to conc ...

  6. 域名IP主动验证(一)

    功能:主动验证给定的域名.IP对是否真正的关联 思路: 1.一开始通过修改hosts文件,把待验证的域名.IP对添加到文件里,然后用wget尝试访问,再恢复hosts文件重新验证下一对 2.后来了解到 ...

  7. 04.NopCommerce启用MiniProfiler调试

    最近在调试NopCommerce的时候,常遇到一个地址不知道请求哪个路由(比如http://localhost/apparel-shoes,比如http://localhost/login)您能快速说 ...

  8. hadoop的安装和配置

    hadoop安装 在Apache Hadoop主页的下载页面https://hadoop.apache.org/releases.html选择版本进行下载: 下载下来的是压缩包: 将压缩包使用Xftp ...

  9. 洛谷2017 5月月赛R1

    我只想说面对这种难度的题目就是冲着20%的数据暴力... 分数:40+20+36.1+38+0+19 T1 签到题 III 题目背景 pj组选手zzq近日学会了求最大公约数的辗转相除法. 题目描述 类 ...

  10. 【学习笔记】深入理解js原型和闭包(3)——prototype原型

    既typeof之后的另一位老朋友! prototype也是我们的老朋友,即使不了解的人,也应该都听过它的大名.如果它还是您的新朋友,我估计您也是javascript的新朋友. 在咱们的第一节(深入理解 ...