正则表达式学习
来源:互联网 发布:aveva软件购买 编辑:程序博客网 时间:2024/05/16 02:03
感想:
正则表达式,xpath,css感觉是一路货。都是用了,看了,就懂;过后不用就忘的那一类。
What Regular Expressions Are Exactly - Terminology
Basically, a regular expression is a pattern describing a certain amount of text. Their name comes from the mathematical theory on which they are based. But we will not dig into that. You will usually find the name abbreviated to "regex" or "regexp".
一、最简单的正则匹配,字符匹配(literal characters)
Twelve characters have special meanings in regular expressions: the backslash \, the caret ^, the dollar sign $, the period or dot., the vertical bar or pipe symbol |, the question mark?, the asterisk or star *, the plus sign+, the opening parenthesis (, the closing parenthesis), the opening square bracket [, and the opening curly brace{. These special characters are often called "metacharacters".
二、元字符
表1.常用的元字符 代码 说明
.( period or dot)
匹配除换行符以外的任意字符
\w
匹配字母或数字或下划线或汉字
\s
匹配任意的空白符
\d
匹配数字
\b
匹配单词的开始或结束
^(caret)
匹配字符串的开始
$(dollar )
匹配字符串的结束
\(backslash)
转义符
|(vertical bar or pipe symbo)
选择符
?( question mark)
零次或一次重复
*(asterisk or star)
零次或多次重复
+(plus sign)
一次或多次重复
( opening parenthesis
定义分组开始,定义断言开始
) closing parenthesis
定义分组结束,定义断言结束
[ opening square bracket
集合定义,如[a-z][aeiou][a|e]
{ opening curly brace
指定重复次数定义,
如:{2}重复2次;
{2,}重复2次或多次
{2,5}重复2次到5次
- 正则表达式口诀 正则表达式学习工具
- 正则表达式学习(一)认识正则表达式
- 正则表达式学习笔记
- 正则表达式学习笔记
- 正则表达式学习笔记
- 正则表达式学习笔记
- 学习正则表达式
- 正则表达式学习日记
- 正则表达式学习
- 学习正则表达式
- 正则表达式学习
- 正则表达式学习小记
- [JavaScript]正则表达式学习
- 正则表达式学习
- 正则表达式相关学习
- 正则表达式学习
- 正则表达式学习笔记
- 正则表达式学习一
- Hadoop平台配置汇总
- HDU 2092 整数解【暴力+水】
- Android PopupWindow的使用
- 常用函数
- android读取手机屏幕宽和高
- 正则表达式学习
- SQL Server 2000中查询表名
- U-boot mkimage指定Linux内核地址时的两种方式
- 用TextView显示时间(数码管样式)
- JavaWeb 服务启动时,在后台启动加载一个线程。
- 设计模式:依赖倒转原则
- ACTIVITI在LINUX下查看流程图片中文字体出现乱码的解决方案
- mysql约束
- Xutils3学习笔记(更新中...)