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

#!/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. 使用git rebase合并多次commit

    使用git rebase合并多次commit 聊下 git rebase -i

  2. eclipse+PyDev里面import win32api报错的问题解决

    windows下面eclipse+PyDev的开发环境,安装了pywin32,写import win32api时老提示错误,在idle里正常执行. 原来是安装python库时,python安装路径下面 ...

  3. bzoj 4871: [Shoi2017]摧毁“树状图”【树形dp】

    做不来--参考https://www.cnblogs.com/ezyzy/p/6784872.html #include<iostream> #include<cstdio> ...

  4. IT兄弟连 Java Web教程 经典案例2

    案例需求:写一个用户登录的html页面有账号和密码,并在登录的Servlet中获取登录的账号和密码,如果账号是abc密码是123则向浏览器输出登录成功,否则向浏览器输出登录失败. 案例实现: ●  h ...

  5. Fiddler 学习

    Little Skill Fiddler 官网: https://www.telerik.com/fiddler 来自 https://www.cnblogs.com/zhaoyanjun/p/706 ...

  6. 关于AFNetWorking 2.5.4之后版本编译报错问题解决方案

    最近升级了AFN框架到2.6版本然后编译却出错了 错误如下: 错误出现在 AFSecurityPolicy.h 这个类中 解决办法如下: 在项目的.pch文件里添加 #ifndef TARGET_OS ...

  7. Asp.net core 框架整理

    https://github.com/thangchung/awesome-dotnet-core#cms

  8. 跟我一起玩Win32开发(24):计时器

    有好些时间没写博客了,今天要来耍一下计时器,就是我们常说的Timer,它虽然不是什么复杂的东西,也称不 上牛X,不过,用处还是不少的,对于那些需要每隔一定时间执行一次的任务,那是相当有用. 先来认识一 ...

  9. 1051 - Good or Bad DFS 记忆化搜索

    http://lightoj.com/volume_showproblem.php?problem=1051 对于每个位置,设dfs(cur, one, two)表示前i个字母,拥有辅音字母one个, ...

  10. PowerShell~语法与运算符

    基本语法 变量:$开头 $a = "Hello" 条件语句:if else ) { Write-Host "偶数" } else{ Write-Host &qu ...