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

#!/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. winform 屏蔽 空格键

    private void call_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Space) ...

  2. C++笔试题库之编程、问答题 300~305道

    301. 以下代码有什么问题? cout << (true?1:”1″) << endl; 答:三元表达式“?:”问号后面的两个操作数必须为同一类型. 302.以下代码能够编译 ...

  3. Codeforces 702B【二分】

    题意: 给一个a数组,输出有多少对相加是等于2^x的.1<=a[i]<=1e9,n<=1e5 思路: a[i]+a[j]=2^x 对于每个a[i],枚举x,然后二分查找a[j]; p ...

  4. 【杂谈】5G有啥用?跟咱有关系么?关注那玩意儿干啥?

    用处大了 有啥用? 云计算啊,你看看你电脑都卡成啥了? 既然5G速度赶上本地读取,那就相当于把硬盘放云端没问题了.那么,看看自己硬盘里都有啥,5G的用处或许就能一点点浮现出来了. ——请不要急着打开一 ...

  5. 洛谷1387(基础二维dp)

    题目很简单,数据也很小,但是思路不妨借鉴:dp[i][j]代表以(i,j)为右下角的最长正方形边长. 类比一维里面设“以XX为结尾的最XXX(所求)”. 另外define不要乱用!尤其这种min套mi ...

  6. Java迭代器的用法【转】

    迭代器(Iterator) 迭代器是一种设计模式,它是一个对象,它可以遍历并选择序列中的对象,而开发人员不需要了解该序列的底层结构.迭代器通常被称为“轻量级”对象,因为创建它的代价小. Java中的I ...

  7. php使用json_decode返回NULL

    php5.2以后自带json_decode函数,但是对json文本串的格式要求非常严格. 很可能使用该函数得到的返回值是NULL 可以使用使用json_last_error()函数获取到的返回值来帮助 ...

  8. ios 微信环境 axios请求 status 0

    做了一个支付页面,调用post请求但是请求status 0,出现这个的原因居然是https的网页请求http的数据. 但是这个再ios里面不会报错,安卓正常. 记录一下客户端的这个特征!

  9. CCF|学生排队|Java

    import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Sc ...

  10. How to proxy a web site by apache2 in Ubuntu

    Install apache2 To execute the install command in terminal: sudo apt-get install apache2 Then, we ca ...