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

#!/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. Tomcat黑窗口改变Title

    start cmd /K " && call startup.bat && pause && exit " 设置Title之后,再手 ...

  2. C++开发工程师面试题库 1~50道

    1.    指出以下变量数据存储位置 全局变量int(*g_pFun)(int);g_pFun=myFunction;g_pFun存储的位置(A ) 为全局的函数指针 指向空间的位置( B) 所有函数 ...

  3. POJ2456【二分】

    题意: n个位置,m个帅气的窝的化身,然后窝要去这些位置,问一个最小距离的最大. 思路: 就是二分最小距离,然后判断一下该最小距离x 下,是不是存在>=m个窝的化身之间的距离>=x就好了: ...

  4. HDU 5101

    hdoj5101 lower_bound函数: 题意: 从两个不同集合拿出两个数,加的和大于k的可行的方案数 思路: 答案=从所有数中选择的两个加和大于k的数的方案数-在同一个集合中选择的两个加和大于 ...

  5. python 导入.py

    转自: https://blog.csdn.net/winycg/article/details/78512300 在同一个文件夹下调用函数:A.py文件: def add(x,y): print(' ...

  6. Jquery | 基础 | 属性过滤选择器

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 洛谷p1115 最大子段和

    题目链接: 最大子段和 题目分析: 动态规划O(n)求解,设f[i]表示以i为终点的最大子段和 分两种情况: 若f[i-1]>0,则显然f[i]=f[i-1]+a[i](a[i]必须包含在内) ...

  8. 洛谷 P2147 [SDOI2008]洞穴勘测

    以下这个做法应该是叫线段树分治... 根据修改操作预处理出每条边存在的时间区间[l,r](以操作序号为时间),然后把所有形式化后的修改挂到线段树节点上. 处理完修改后,dfs一遍线段树,进入某个节点时 ...

  9. 三色灯渐变DIY制作

    小编前几天查资料,怎么使用12864屏幕的用法,突然发觉微博是个好东西,随着自己的成长,学习了很多的知识,没有做笔记的习惯,只是习惯把用到的硬件,传感器,资料写到程序的备注内,但感觉,用到时不是那么方 ...

  10. 外文翻译 《How we decide》被情感愚弄 第三节

    本科论文答辩终于结束啦,一切都要继续回到正轨. 这是第三章章最后一节 书的导言 本章第二节 本章第一节 "信用卡是我的敌人."Herman Palmer这样说到.在平日,Herma ...