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

#!/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. MySQL与MongoDB的区别

    一.MongoDB简介 什么是MongoDB ?MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统.在高负载的情况下,添加更多的节点,可以保证服务器性能.MongoDB 旨 ...

  2. bzoj 3513: [MUTC2013]idiots【生成函数+FFT】

    想了好长时间最后发现真是石乐志 第一反应就是两边之和大于第三边,但是这个东西必须要满足三次-- 任意的两边之和合通过生成函数套路+FFT求出来(记得去掉重复选取的),然后这任意两边之和大于任意第三边可 ...

  3. maven在window下的环境变量配置

    配置maven环境变量cmd控制台提示:mvn不是内部或外部命令,也不是可运行的程序或批处理文件 首先maven环境变量: 变量名:MAVEN_HOME 变量值:E:\apache-maven-3.2 ...

  4. CF580D Kefa and Dishes 【状压dp】By cellur925

    题目传送门 友情链接:new2zydalao%%%  一篇优秀的状压文章 题目大意:$n$个菜有$k$个规则,如果kefa在吃完第$xi$个菜之后吃了第$yi$个菜(保证$xi$.$yi$不相等), ...

  5. Java关键字abstract与final总结

    关键字:abstract 用来修饰抽象类与抽象类中的方法 抽象类需要注意的几点: 抽象类不能被实例化.抽象类可以包含属性:方法:构造方法,但是构造方法不能用来new实例,只能被子类调用 有抽象方法的类 ...

  6. TCP协议深度刨析

    这篇文章主要是详细说明TCP的拥塞控制,因为它对于我们理解整个TCP/IP协议栈非常重要,但我个人能力有限,其中引用了很多网上其他博主的文章,在下文引用处都有说明,主要是让整篇文章能够连贯,不至于让所 ...

  7. Beta版本发布!

    该作业所属课程:https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass2 作业地址:https://edu.cnblogs.com/c ...

  8. Hdu 5439 Aggregated Counting (2015长春网络赛 ACM/ICPC Asia Regional Changchun Online 找规律)

    题目链接: Hdu 5439 Aggregated Counting 题目描述: 刚开始给一个1,序列a是由a[i]个i组成,最后1就变成了1,2,2,3,3,4,4,4,5,5,5.......,最 ...

  9. archive log full ora-00257

    ############# sample 0 asmcmd show free 37G in archive_log ASMCMD> lsdgState Type Rebal Unbal Sec ...

  10. log4j:WARN Please initialize the log4j system properly. 异常解决

    log4j:WARN Please initialize the log4j system properly. 这个异常很少遇到,咋一看,原来是没有配置logger4j的配置文件 问题解决方法: 传统 ...