From f4c1d1e274cea921e04d87f8488a948d832c4cb9 Mon Sep 17 00:00:00 2001
From: GrayLand
+
+g@e<2DDml7E=_3j
z!Ys6OGrpZDt2P!0OOuJ$Ic?K8OxJ$BpZ<8b`iG-rFIR+oso#RB-ppv46~dHRgnj~n
z#u@b_(663}TXE_C(wn+$sF(d@FhMQs^Og3Rq
MvLiUpp
zH9siDTaDvhW5wG*a6hh~672UVzG&;a3)Ff$fZRk-i(JCsftrh`_(a@I4QE?9$_7P(
z*@WC24b)RUs=99F;6>a1o
+rDdGW%w3xve2Y4`xd6~kFHRqMJ|V4_wP}C7#!1>^5VeRLZdw;Z1TR(xxEYQl
zmnBG&(_e2
#mpquuHF
zv|~`y^rzh&$ih9?es9`>O)#&v<%2!86eJ
+
+
+
+## 什么是正则表达式?
+
+> 正则表达式是一组由字母和符号组成的特殊文本, 它可以用来从文本中找出满足你想要的格式的句子.
+
+
+一个正则表达式是在一个主体字符串中从左到右匹配字符串时的一种样式.
+例如"Regular expression"是一个完整的句子, 但我们常使用缩写的术语"regex"或"regexp".
+正则表达式可以用来替换文本中的字符串,验证形式,提取字符串等等.
+
+想象你正在写一个应用, 然后你想设定一个用户命名的规则, 让用户名包含字符,数字,下划线和连字符,以及限制字符的个数,好让名字看起来没那么丑.
+我们使用以下正则表达式来验证一个用户名:
+
+
+
+
+"the" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/dmRygT/1)
+
+正则表达式`123`匹配字符串`123`. 它逐个字符的与输入的正则表达式做比较.
+
+正则表达式是大小写敏感的, 所以`The`不会匹配`the`.
+
+
+"The" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/1paXsy/1)
+
+## 2. 元字符
+
+正则表达式主要依赖于元字符.
+元字符不代表他们本身的字面意思, 他们都有特殊的含义. 一些元字符写在方括号中的时候有一些特殊的意思. 以下是一些元字符的介绍:
+
+|元字符|描述|
+|:----:|----|
+|.|句号匹配任意单个字符除了换行符.|
+|[ ]|字符种类. 匹配方括号内的任意字符.|
+|[^ ]|否定的字符种类. 匹配除了方括号里的任意字符|
+|*|匹配>=0个重复的在*号之前的字符.|
+|+|匹配>1个重复的+号前的字符.
+|?|标记?之前的字符为可选.|
+|{n,m}|匹配num个中括号之前的字符 (n <= num <= m).|
+|(xyz)|字符集, 匹配与 xyz 完全相等的字符串.|
+|||或运算符,匹配符号前或后的字符.|
+|\|转义字符,用于匹配一些保留的字符 [ ] ( ) { } . * + ? ^ $ \ |
|
+|^|从开始行开始匹配.|
+|$|从末端开始匹配.|
+
+## 2.1 点运算符 `.`
+
+`.`是元字符中最简单的例子.
+`.`匹配任意单个字符, 但不匹配换行符.
+例如, 表达式`.ar`匹配一个任意字符后面跟着是`a`和`r`的字符串.
+
+
+".ar" => The car parked in the garage.
+
+
+[在线练习](https://regex101.com/r/xc9GkU/1)
+
+## 2.2 字符集
+
+字符集也叫做字符类.
+方括号用来指定一个字符集.
+在方括号中使用连字符来指定字符集的范围.
+在方括号中的字符集不关心顺序.
+例如, 表达式`[Tt]he` 匹配 `the` 和 `The`.
+
+
+"[Tt]he" => The car parked in the garage.
+
+
+[在线练习](https://regex101.com/r/2ITLQ4/1)
+
+方括号的句号就表示句号.
+表达式 `ar[.]` 匹配 `ar.`字符串
+
+
+"ar[.]" => A garage is a good place to park a car.
+
+
+[在线练习](https://regex101.com/r/wL3xtE/1)
+
+### 2.2.1 否定字符集
+
+一般来说 `^` 表示一个字符串的开头, 但它用在一个方括号的开头的时候, 它表示这个字符集是否定的.
+例如, 表达式`[^c]ar` 匹配一个后面跟着`ar`的除了`c`的任意字符.
+
+
+"[^c]ar" => The car parked in the garage.
+
+
+[在线练习](https://regex101.com/r/nNNlq3/1)
+
+## 2.3 重复次数
+
+后面跟着元字符 `+`, `*` or `?` 的, 用来指定匹配子模式的次数.
+这些元字符在不同的情况下有着不同的意思.
+
+### 2.3.1 `*` 号
+
+`*`号匹配 在`*`之前的字符出现`大于等于0`次.
+例如, 表达式 `a*` 匹配以0或更多个a开头的字符, 因为有0个这个条件, 其实也就匹配了所有的字符. 表达式`[a-z]*` 匹配一个行中所有以小写字母开头的字符串.
+
+
+"[a-z]*" => The car parked in the garage #21.
+
+
+[在线练习](https://regex101.com/r/7m8me5/1)
+
+`*`字符和`.`字符搭配可以匹配所有的字符`.*`.
+`*`和表示匹配空格的符号`\s`连起来用, 如表达式`\s*cat\s*`匹配0或更多个空格开头和0或更多个空格结尾的cat字符串.
+
+
+"\s*cat\s*" => The fat cat sat on the concatenation.
+
+
+[在线练习](https://regex101.com/r/gGrwuz/1)
+
+### 2.3.2 `+` 号
+
+`+`号匹配`+`号之前的字符出现 >=1 次个字符.
+例如表达式`c.+t` 匹配以首字母`c`开头以`t`结尾,中间跟着任意个字符的字符串.
+
+
+"c.+t" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/Dzf9Aa/1)
+
+### 2.3.3 `?` 号
+
+在正则表达式中元字符 `?` 标记在符号前面的字符为可选, 即出现 0 或 1 次.
+例如, 表达式 `[T]?he` 匹配字符串 `he` 和 `The`.
+
+
+"[T]he" => The car is parked in the garage.
+
+
+[在线练习](https://regex101.com/r/cIg9zm/1)
+
+
+"[T]?he" => The car is parked in the garage.
+
+
+[在线练习](https://regex101.com/r/kPpO2x/1)
+
+## 2.4 `{}` 号
+
+在正则表达式中 `{}` 是一个量词, 常用来一个或一组字符可以重复出现的次数.
+例如, 表达式 `[0-9]{2,3}` 匹配 2~3 位 0~9 的数字.
+
+
+
+"[0-9]{2,3}" => The number was 9.9997 but we rounded it off to 10.0.
+
+
+[在线练习](https://regex101.com/r/juM86s/1)
+
+我们可以省略第二个参数.
+例如, `[0-9]{2,}` 匹配至少两位 0~9 的数字.
+
+如果逗号也省略掉则表示重复固定的次数.
+例如, `[0-9]{3}` 匹配3位数字
+
+
+"[0-9]{2,}" => The number was 9.9997 but we rounded it off to 10.0.
+
+
+[在线练习](https://regex101.com/r/Gdy4w5/1)
+
+
+"[0-9]{3}" => The number was 9.9997 but we rounded it off to 10.0.
+
+
+[在线练习](https://regex101.com/r/Sivu30/1)
+
+## 2.5 `(...)` 特征标群
+
+特征标群是一组写在 `(...)` 中的子模式. 例如之前说的 `{}` 是用来表示前面一个字符出现指定次数. 但如果在 `{}` 前加入特征标群则表示整个标群内的字符重复 N 次. 例如, 表达式 `(ab)*` 匹配连续出现 0 或更多个 `ab`.
+
+我们还可以在 `()` 中用或字符 `|` 表示或. 例如, `(c|g|p)ar` 匹配 `car` 或 `gar` 或 `par`.
+
+
+"(c|g|p)ar" => The car is parked in the garage.
+
+
+[在线练习](https://regex101.com/r/tUxrBG/1)
+
+## 2.6 `|` 或运算符
+
+或运算符就表示或, 用作判断条件.
+
+例如 `(T|t)he|car` 匹配 `(T|t)he` 或 `car`.
+
+
+"(T|t)he|car" => The car is parked in the garage.
+
+
+[在线练习](https://regex101.com/r/fBXyX0/1)
+
+## 2.7 转码特殊字符
+
+反斜线 `\` 在表达式中用于转码紧跟其后的字符. 用于指定 `{ } [ ] / \ + * . $ ^ | ?` 这些特殊字符. 如果想要匹配这些特殊字符则要在其前面加上反斜线 `\`.
+
+例如 `.` 是用来匹配除换行符外的所有字符的. 如果想要匹配句子中的 `.` 则要写成 `\.`.
+
+
+"(f|c|m)at\.?" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/DOc5Nu/1)
+
+## 2.8 锚点
+
+在正则表达式中, 想要匹配指定开头或结尾的字符串就要使用到锚点. `^` 指定开头, `$` 指定结尾.
+
+### 2.8.1 `^` 号
+
+`^` 用来检查匹配的字符串是否在所匹配字符串的开头.
+
+例如, 在 `abc` 中使用表达式 `^a` 会得到结果 `a`. 但如果使用 `^b` 将匹配不到任何结果. 应为在字符串 `abc` 中并不是以 `b` 开头.
+
+例如, `^(T|t)he` 匹配以 `The` 或 `the` 开头的字符串.
+
+
+"(T|t)he" => The car is parked in the garage.
+
+
+[在线练习](https://regex101.com/r/5ljjgB/1)
+
+
+"^(T|t)he" => The car is parked in the garage.
+
+
+[在线练习](https://regex101.com/r/jXrKne/1)
+
+### 2.8.2 `$` 号
+
+同理于 `^` 号, `$` 号用来匹配字符是否是最后一个.
+
+例如, `(at\.)$` 匹配以 `at.` 结尾的字符串.
+
+
+"(at\.)" => The fat cat. sat. on the mat.
+
+
+[在线练习](https://regex101.com/r/y4Au4D/1)
+
+
+"(at\.)$" => The fat cat. sat. on the mat.
+
+
+[在线练习](https://regex101.com/r/t0AkOd/1)
+
+## 3. 简写字符集
+
+正则表达式提供一些常用的字符集简写. 如下:
+
+|简写|描述|
+|:----:|----|
+|.|除换行符外的所有字符|
+|\w|匹配所有字母数字, 等同于 `[a-zA-Z0-9_]`|
+|\W|匹配所有非字母数字, 即符号, 等同于: `[^\w]`|
+|\d|匹配数字: `[0-9]`|
+|\D|匹配非数字: `[^\d]`|
+|\s|匹配所有空格字符, 等同于: `[\t\n\f\r\p{Z}]`|
+|\S|匹配所有非空格字符: `[^\s]`|
+
+## 4. 前后关联约束(前后预查)
+
+前置约束和后置约束都属于**非捕获簇**(用于匹配不在匹配列表中的格式).
+前置约束用于判断所匹配的格式是否在另一个确定的格式之后.
+
+例如, 我们想要获得所有跟在 `$` 符号后的数字, 我们可以使用正向向后约束 `(?<=\$)[0-9\.]*`.
+这个表达式匹配 `$` 开头, 之后跟着 `0,1,2,3,4,5,6,7,8,9,.` 这些字符可以出现大于等于 0 次.
+
+前后关联约束如下:
+
+|符号|描述|
+|:----:|----|
+|?=|前置约束-存在|
+|?!|前置约束-排除|
+|?<=|后置约束-存在|
+|?
+"[T|t]he(?=\sfat)" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/IDDARt/1)
+
+### 4.2 `?!...` 前置约束-排除
+
+前置约束-排除 `?!` 用于筛选所有匹配结果, 筛选条件为 其后不跟随着定义的格式
+`前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`.
+
+表达式 `[T|t]he(?!\sfat)` 匹配 `The` 和 `the`, 且其后不跟着 `(空格)fat`.
+
+
+"[T|t]he(?!\sfat)" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/V32Npg/1)
+
+### 4.3 `?<= ...` 后置约束-存在
+
+后置约束-存在 记作`(?<=...)` 用于筛选所有匹配结果, 筛选条件为 其前跟随着定义的格式.
+例如, 表达式 `(?<=[T|t]he\s)(fat|mat)` 匹配 `fat` 和 `mat`, 且其前跟着 `The` 或 `the`.
+
+
+"(?<=[T|t]he\s)(fat|mat)" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/avH165/1)
+
+### 4.4 `?
+"(?<![T|t]he\s)(cat)" => The cat sat on cat.
+
+
+[在线练习](https://regex101.com/r/8Efx5G/1)
+
+## 5. 标志
+
+标志也叫修饰语, 因为它可以用来修改表达式的搜索结果.
+这些标志可以任意的组合使用, 它也是整个正则表达式的一部分.
+
+|标志|描述|
+|:----:|----|
+|i|忽略大小写.|
+|g|全局搜索.|
+|m|多行的: 锚点元字符 `^` `$` 工作范围在每行的起始.|
+
+### 5.1 忽略大小写 (Case Insensitive)
+
+修饰语 `i` 用于忽略大小写.
+例如, 表达式 `/The/gi` 表示在全局搜索 `The`, 在后面的 `i` 将其条件修改为忽略大小写, 则变成搜索 `the` 和 `The`, `g` 表示全局搜索.
+
+
+"The" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/dpQyf9/1)
+
+
+"/The/gi" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/ahfiuh/1)
+
+### 5.2 全局搜索 (Global search)
+
+修饰符 `g` 常用语执行一个全局搜索匹配, 即(不仅仅返回第一个匹配的, 而是返回全部).
+例如, 表达式 `/.(at)/g` 表示搜索 任意字符(除了换行) + `at`, 并返回全部结果.
+
+
+"/.(at)/" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/jnk6gM/1)
+
+
+"/.(at)/g" => The fat cat sat on the mat.
+
+
+[在线练习](https://regex101.com/r/dO1nef/1)
+
+### 5.3 多行修饰符 (Multiline)
+
+多行修饰符 `m` 常用语执行一个多行匹配.
+
+像之前介绍的 `(^,$)` 用于检查格式是否是在待检测字符串的开头或结尾. 但我们如果想要它在每行的开头和结尾生效, 我们需要用到多行修饰符 `m`.
+
+例如, 表达式 `/at(.)?$/gm` 表示在待检测字符串每行的末尾搜索 `at`后跟一个或多个 `.` 的字符串, 并返回全部结果.
+
+
+"/.at(.)?$/" => The fat
+ cat sat
+ on the mat.
+
+
+[在线练习](https://regex101.com/r/hoGMkP/1)
+
+
+"/.at(.)?$/gm" => The fat
+ cat sat
+ on the mat.
+
+
+[在线练习](https://regex101.com/r/E88WE2/1)
+
+## 额外补充
+
+* *正整数*: `^\d+$`
+* *负整数*: `^-\d+$`
+* *手机国家号*: `^+?[\d\s]{3,}$`
+* *手机号*: `^+?[\d\s]+(?[\d\s]{10,}$`
+* *整数*: `^-?\d+$`
+* *用户名*: `^[\w\d_.]{4,16}$`
+* *数字和英文字母*: `^[a-zA-Z0-9]*$`
+* *数字和应为字母和空格*: `^[a-zA-Z0-9 ]*$`
+* *密码*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$`
+* *邮箱*: `^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})*$`
+* *IP4 地址*: `^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$`
+* *纯小写字母*: `^([a-z])*$`
+* *纯大写字母*: `^([A-Z])*$`
+* *URL*: `^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$`
+* *VISA 信用卡号*: `^(4[0-9]{12}(?:[0-9]{3})?)*$`
+* *日期 (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$`
+* *日期 (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$`
+* *MasterCard 信用卡号*: `^(5[1-5][0-9]{14})*$`
+
+## 贡献
+
+* 报告问题
+* 开放合并请求
+* 传播此文档
+* 直接和我联系 ziishaned@gmail.com 或 [](https://twitter.com/ziishaned)
+
+## 许可证
+
+MIT © [Zeeshan Ahmed](mailto:ziishaned@gmail.com)
diff --git a/README.md b/README.md
index 1a9ba3db..84cfc679 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,9 @@
+
+
+
+
+"the" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/dmRygT/1) + +La expresión regular `123` coincide con la cadena `123`. La expresión regular se compara con una cadena de entrada al comparar cada carácter de la expresión regular con cada carácter de la cadena de entrada, uno tras otro. Las expresiones regulares son normalmente sensibles a mayúsculas y minúsculas, por lo que la expresión regular `The` no coincide con la cadena `the`. + +
+"The" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/1paXsy/1) + +## 2. Meta caracteres + +Los caracteres meta son los bloques de construcción de las expresiones regulares. Los meta caracteres no se sostienen a sí mismos, sino que se interpretan de alguna manera especial. Algunos meta caracteres tienen un significado especial y se escriben entre corchetes. Los meta caracteres son los siguientes: + +|Meta character|Description| +|:----:|----| +|.|Periodo. Coincide con cualquier caracter excepto un salto de línea.| +|[ ]|Clase caracter. Coincide con cualquier caracter contenido entre corchetes.| +|[^ ]|Clase caracter negado. Coincide con cualquier caracter que no está contenido dentro de los corchetes.| +|*|Corresponde con 0 o más repeticiones del símbolo precedente.| +|+|Corresponde con 1 o más repeticiones del símbolo precedente.| +|?|Hace que el símbolo precedente sea opcional.| +|{n,m}|Llaves.Corresponde al menos "n" pero no más de "m" repeticiones del símbolo precedente.| +|(xyz)|Grupo caracter. Hace coincidir los caracteres xyz en ese orden exacto.| +|||Alternancia. Corresponde a los caracteres anteriores o los caracteres después del símbolo.| +|\|Escapa el siguiente caracter. Esto le permite hacer coincidir los caracteres reservados
[ ] ( ) { } . * + ? ^ $ \ |
|
+|^|Hace coincidir el principio de la entrada.|
+|$|Corresponde al final de la entrada.|
+
+## 2.1 Full stop
+
+Full stop `.` es el ejemplo más simple del meta-caracter. El caracter meta "." coincide con cualquier carácter. No coincidirá con el retorno o nuevos caracteres de línea. Por ejemplo, la expresión regular `.ar` significa: cualquier caracter, seguido de la letra`a`, seguido de la letra "r".
+
++".ar" => The car parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/xc9GkU/1) + +## 2.2 Conjunto de caracteres + +Los conjuntos de caracteres también se llaman clase de caracteres. Los corchetes se utilizan para especificar conjuntos de caracteres. Utilice un guión dentro de un conjunto de caracteres para especificar el rango de los caracteres. El orden del rango de caracteres dentro de corchetes no importa. Por ejemplo, la expresión regular "[Tt] he" significa: una letra mayúscula "T" o
+"[Tt]he" => The car parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/2ITLQ4/1) + +Sin embargo, un período dentro de un conjunto de caracteres significa un período literal. La expresión regular `ar [.]` Significa: un carácter minúsculo `a`, seguido de la letra` r`, seguido de un carácter `.`. + +
+"ar[.]" => A garage is a good place to park a car. ++ +[Prueba la expresión regular](https://regex101.com/r/wL3xtE/1) + +### 2.2.1 Conjunto de caracteres negados + +En general, el símbolo de intercalación representa el comienzo de la cadena, pero cuando se escribe después del corchete de apertura niega el conjunto de caracteres. Por ejemplo, la expresión regular `[^c] ar` significa: cualquier carácter, excepto `c`, seguido del carácter `a`, seguido de la letra `r`. + +
+"[^c]ar" => The car parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/nNNlq3/1) + +## 2.3 Repeticiones + +Siguiendo los caracteres meta +, * o ?, se utilizan para especificar cuántas veces puede producirse un subpatrón. Estos meta-caracteres actúan de manera diferente en diferentes situaciones. + +### 2.3.1 Asterísco + +El símbolo `*` coincide con cero o más repeticiones del marcador anterior. La expresión regular `a*` significa: cero o más repeticiones del carácter en minúscula precedente `a`. Pero si aparece después de un conjunto de caracteres o una clase, entonces encuentra las repeticiones de todo el conjunto de caracteres. Por ejemplo, la expresión regular `[a-z]*` significa: cualquier número de letras minúsculas en una fila. + +
+"[a-z]*" => The car parked in the garage #21. ++ +[Prueba la expresión regular](https://regex101.com/r/7m8me5/1) + +El símbolo `*` se puede utilizar con el meta-caracter `.` para que coincida con cualquier cadena de caracteres `.*`. El símbolo `*` se lo puede utilizar con el caracter de espacio en blanco `\s` para que coincida con una cadena de caracteres de espacio en blanco. Por ejemplo, la expresión "\s*cat\s*" significa: cero o más espacios, seguido por el carácter en minúscula `c`, seguido del carácter en minúscula `a`, seguido del carácter en minúscula `t`, seguido de cero o más espacios. + +
+"\s*cat\s*" => The fat cat sat on the concatenation. ++ +[Prueba la expresión regular](https://regex101.com/r/gGrwuz/1) + +### 2.3.2 Signo más + +El símbolo `+` coincide con una o más repeticiones del carácter anterior. Por ejemplo, la expresión regular `c.+T` significa: letra en minúscula `c`, seguida por al menos uno del mismo carácter, luego el carácter en minúscula `t`. + +
+"c.+t" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/Dzf9Aa/1) + +### 2.3.3 Signo de pregunta + +En expresiones regulares el meta-caracter `?` hace que el caracter precedente sea opcional. Este símnbolo coincide con cero o una instancia del caracter precedente. Por ejemplo, la expresión regular `[T]?he` significa: El caracteropcional predecesor `T` seguido por la letra en minúscula `h`, seguido del caracter en minúscula `e`. + +
+"[T]he" => The car is parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/cIg9zm/1) + +
+"[T]?he" => The car is parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/kPpO2x/1) + +## 2.4 Llaves + +En la expresión regular, las llaves que también se denominan cuantificadores se utilizan para especificar el número de veces que se puede repetir un carácter o un grupo de caracteres. Por ejemplo, la expresión regular `[0-9]{2,3}` significa: Combina al menos 2 dígitos pero no más de 3 (caracteres del rango de 0 a 9). + +
+"[0-9]{2,3}" => The number was 9.9997 but we rounded it off to 10.0. ++ +[Prueba la expresión regular](https://regex101.com/r/juM86s/1) + +Podemos dejar fuera el segundo número. Por ejemplo, la expresión regular `[0-9] {2,}` significa: Combina 2 o más dígitos. Si también eliminamos la coma, la expresión regular `[0-9]{3}` significa: coincidir exactamente con 3 dígitos. + +
+"[0-9]{2,}" => The number was 9.9997 but we rounded it off to 10.0. ++ +[Prueba la expresión regular](https://regex101.com/r/Gdy4w5/1) + +
+"[0-9]{3}" => The number was 9.9997 but we rounded it off to 10.0. ++ +[Prueba la expresión regular](https://regex101.com/r/Sivu30/1) + +## 2.5 Grupos de caracteres + +Grupo de caracteres es un grupo de sub-patrones que se escribe dentro de paréntesis `(...)`. Como hemos discutido antes en la expresión regular si ponemos un cuantificador después de un caracter, repetiremos el caracter anterior. Pero si ponemos cuantificador después de un grupo de caracteres, entonces repetimos todo el grupo de caracteres. Por ejemplo, la expresión regular `(ab)*` coincide con cero o más repeticiones del caracter "ab". También podemos usar el caracter de alternancia `|` meta dentro del grupo de caracteres. Por ejemplo, la expresión regular `(c|g|p)ar` significa: caracter en minúscula `c`, `g` o `p`, seguido del caracter `a`, seguido del caracter `r`. +
+"(c|g|p)ar" => The car is parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/tUxrBG/1) + +## 2.6 Alternancia + +En la expresión regular se usa la barra vertical `|` para definir la alternancia. La alternancia es como una condición entre múltiples expresiones. Ahora, puedes estar pensando que el conjunto de caracteres y la alternancia funciona de la misma manera. Pero la gran diferencia entre el conjunto de caracteres y la alternancia es que el conjunto de caracteres funciona a nivel de caracter pero la alternancia funciona a nivel de expresión. Por ejemplo, la expresión regular `(T|t)he|car` significa: el carcter en mayúscula `T` o en minúscula `t`, seguido del caracter en minúscula `h`, seguido del caracter en minúscula `e` o del caracter en minúscula `c`, seguido de un caracter en minúscula `a`, seguido del carácter en minúscula `r`. + +
+"(T|t)he|car" => The car is parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/fBXyX0/1) + +## 2.7 Caracteres especiales de escape + +La barra invertida `\` se utiliza en la expresión regular para escapar del carácter siguiente. Esto permite especificar un símbolo como un caracter coincidente incluyendo caracteres reservados `{}[]/\+*.^|?`. Por ejemplo, la expresión regular `.` se utiliza para coincidir con cualquier caracter, excepto la nueva línea. Ahora, para emparejar `.` en una cadena de entrada, la expresión regular `(f|c|m)at\.?` significa: la letra minúscula `f`, `c` o `m`, seguida del caracter en minúscula `a`, seguido de la letra minúscula `t`, seguida del caracter opcional `.`. + +
+"(f|c|m)at\.?" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/DOc5Nu/1) + +## 2.8 Anclas + +En expresiones regulares, usamos anclas para comprobar si el símbolo de coincidencia es el símbolo inicial o el símbolo final de la cadena de entrada. Los anclajes son de dos tipos: El primer tipo es el símbolo `^` que comprueba si el caracter coincidente es el caracter inicial de la entrada y el segundo tipo es Dollar `$` que comprueba si el caracter coincidente es el último caracter de la cadena de entrada. + +### 2.8.1 Simbolo de intercalación + +El símbolo de intercalación `^` se usa para verificar si el caracter coincidente es el primer caracter de la cadena de entrada. Si aplicamos la siguiente expresión regular `^a` (si a es el símbolo inicial) a la cadena de entrada `abc` coincide con `a`. Pero si aplicamos la expresión regular `^b` en la cadena de entrada anterior, no coincide con nada. Porque en la cadena de entrada `abc` "b" no es el símbolo inicial. Vamos a echar un vistazo a otra expresión regular `^(T|t)he`, significa: mayúsculas `T` o la letra minúscula `t` es el símbolo inicial de la cadena de entrada, seguido del caracter minúscula `h` y seguido del caracter en minúscula `e`. + +
+"(T|t)he" => The car is parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/5ljjgB/1) + +
+"^(T|t)he" => The car is parked in the garage. ++ +[Prueba la expresión regular](https://regex101.com/r/jXrKne/1) + +### 2.8.2 Símbolo dolar + +El símbolo de dólar `$` se utiliza para comprobar si el caracter coincidente es el último carácter de la cadena de entrada. Por ejemplo, la expresión regular `(at\.)$` significa: un caracter en minúscula `a`, seguido del caracter en minúscula `t` seguido de un carácter `.` y el marcador debe ser el final de la cadena. + +
+"(at\.)" => The fat cat. sat. on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/y4Au4D/1) + +
+"(at\.)$" => The fat cat. sat. on the mat. ++ +[Pueba la expresión regular](https://regex101.com/r/t0AkOd/1) + +## 3. Conjunto de caracteres abreviados + +La expresión regular proporciona abreviaturas para los conjuntos de caracteres +comúnmente utilizados, que ofrecen abreviaturas convenientes para expresiones +regulares de uso común. Los conjuntos de caracteres abreviados son los siguientes: + +|Shorthand|Description| +|:----:|----| +|.|Cualquier caracter excepto la nueva línea| +|\w|Coincide con los caracteres alfanuméricos: `[a-zA-Z0-9_]`| +|\W|Coincide con los caracteres no alfanuméricos: `[^\w]`| +|\d|Coincide con dígitos: `[0-9]`| +|\D|Coincide con no dígitos: `[^\d]`| +|\s|Coincide con caracteres espaciales: `[\t\n\f\r\p{Z}]`| +|\S|Coincide con caracteres no espaciales: `[^\s]`| + +## 4. Mirar alrededor + +Mirar hacia delante (lookaheds) y mirar hacia atrás (Lookbehind) a veces conocidos +como lookaround son tipo específico de ***grupo que no captura*** (Utilice para +coincidir con el patrón pero no se incluye en la lista correspondiente). Los +lookaheads se usan cuando tenemos la condición de que este patrón es precedido o +seguido por otro patrón determinado. Por ejemplo, queremos obtener todos los números +que están precedidos por el carácter `$` de la siguiente cadena de entrada +`$4.44 y $10.88`. Usaremos la siguiente expresión regular `(?<=\$)[0-9\.] *`, +esto significa: obtener todos los números que contienen el carácter `.` y +están precedidos del carácter `$`. A continuación se muestran los lookarounds +que se utilizan en expresiones regulares: + +|Symbol|Description| +|:----:|----| +|?=|Positive Lookahead| +|?!|Negative Lookahead| +|?<=|Positive Lookbehind| +|? +"[T|t]he(?=\sfat)" => The fat cat sat on the mat. + + +[Prueba la expresión regular](https://regex101.com/r/IDDARt/1) + +### 4.2 Mirar hacia adelate negativa + +El lookahead negativo se usa cuando necesitamos obtener todas las coincidencias +de la cadena de entrada que no son seguidas por un patrón. El aspecto negativo se +define de la misma manera que definimos el aspecto positivo, pero la única diferencia +es que en lugar del caracter igual `=` utilizamos la negción `!` , es decir, +`(?! ...)`. Vamos a echar un vistazo a la siguiente expresión regular `[T|t]he(?!\Sfat)` +que significa: obtener todas las `The` o `the` seguidos por la palabra `fat` precedido por un carácter de espacio. + + +
+"[T|t]he(?!\sfat)" => The fat cat sat on the mat. ++ +[Prueba la expresión](https://regex101.com/r/V32Npg/1) + +### 4.3 Mirar hacia atras positiva + +Positivo lookbehind se utiliza para obtener todos los caracteres que están precedidos +por un patrón específico. La apariencia positiva se denomina `(?<=...)`. +Por ejemplo, la expresión regular `(? <= [T|t]he\s)(fat|mat)` significa: obtener todas las palabras +`fat` o `mat` de la cadena de entrada después de la palabra `The` o `the`. + +
+"(?<=[T|t]he\s)(fat|mat)" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/avH165/1) + +### 4.4 Mirar hacia atras negativa + +El lookbehind negativo se utiliza para obtener todas las coincidencias que no +están precedidas por un patrón específico. El lookbehind negativo se denota por +`(? +"(?<![T|t]he\s)(cat)" => The cat sat on cat. + + +[Prueba la expresión regular](https://regex101.com/r/8Efx5G/1) + +## 5. Banderas + +Los indicadores también se llaman modificadores porque modifican la salida +de una expresión regular. Estos indicadores se pueden utilizar en cualquier orden +o combinación, y son una parte integral de RegExp. + + +|Bandera|Descripción| +|:----:|----| +|i|Insensible a mayúsculas y minúsculas: ajusta la coincidencia para que no distinga mayúsculas y minúsculas.| +|g|Búsqueda global: busque un patrón en toda la cadena de entrada.| +|m|Multilinea: Ancla meta caracter trabaja en cada linea.| + +### 5.1 Mayúscula y minúscula + +El modificador `i` se utiliza para realizar la coincidencia entre mayúsculas y +minúsculas. Por ejemplo, la expresión regular `/The/gi` significa: letra mayúscula +`T`, seguido del caracter en minúscula `h`, seguido del carácter `e`. Y al final +de la expresión regular, el indicador `i` indica al motor de expresiones +regulares que ignore el caso. Como puede ver, también ofrecemos el indicador +`g` porque queremos buscar el patrón en toda la cadena de entrada. + + +
+"The" => The fat cat sat on the mat. ++ +[Prueba la expresión regularn](https://regex101.com/r/dpQyf9/1) + +
+"/The/gi" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/ahfiuh/1) + +### 5.2 Búsqueda global + +El modificador `g` se utiliza para realizar una coincidencia global +(encontrar todos las coincidencias en lugar de detenerse después de la primera coincidencia). +Por ejemplo, la expresión regular `/.(At)/g` significa: cualquier carácter, +excepto la nueva línea, seguido del caracter minúsculo `a`, seguido del caracter +en minúscula `t`. Debido a que siempre `g` prevee la bandera al final de la expresión +regular ahora encontrará todas las coincidencias de toda la cadena de entrada. + + +
+"/.(at)/" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/jnk6gM/1) + +
+"/.(at)/g" => The fat cat sat on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/dO1nef/1) + +### 5.3 Multilinea + +El modificador `m` se utiliza para realizar una coincidencia de varias líneas. +Como analizamos anteriormente, las anclas `(^,$)` se utilizan para comprobar si +el patrón es el comienzo de la entrada o el final de la cadena de entrada. Pero +si queremos que las anclas funcionen en cada línea usamos la bandera `m`. +Por ejemplo, la expresión regular `/at(.)?$/Gm` +significa: caracter en minúscula` a`, seguido del caracter minúsculo `t`, +opcionalmente cualquier cosa menos la nueva línea. Y debido a `m` bandera ahora +el motor de expresión regular coincide con el patrón al final de cada línea de una cadena. + +
+"/.at(.)?$/" => The fat + cat sat + on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/hoGMkP/1) + +
+"/.at(.)?$/gm" => The fat + cat sat + on the mat. ++ +[Prueba la expresión regular](https://regex101.com/r/E88WE2/1) + +## Bonus + +* *Positive Integers*: `^\d+$` +* *Negative Integers*: `^-\d+$` +* *US Phone Number*: `^+?[\d\s]{3,}$` +* *US Phone with code*: `^+?[\d\s]+(?[\d\s]{10,}$` +* *Integers*: `^-?\d+$` +* *Username*: `^[\w.]{4,16}$` +* *Alpha-numeric characters*: `^[a-zA-Z0-9]*$` +* *Alpha-numeric characters with spaces*: `^[a-zA-Z0-9 ]*$` +* *Password*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$` +* *email*: `^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})*$` +* *IPv4 address*: `^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$` +* *Lowercase letters only*: `^([a-z])*$` +* *Uppercase letters only*: `^([A-Z])*$` +* *URL*: `^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$` +* *VISA credit card numbers*: `^(4[0-9]{12}(?:[0-9]{3})?)*$` +* *Date (DD/MM/YYYY)*: `^(0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2}$` +* *Date (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$` +* *Date (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$` +* *MasterCard credit card numbers*: `^(5[1-5][0-9]{14})*$` +* *Hashtags*: Including hashtags with preceding text (abc123#xyz456) or containing white spaces within square brackets (#[foo bar]) : `\S*#(?:\[[^\]]+\]|\S+)` +* *@mentions*: `\B@[a-z0-9_-]+` +## Contribution + +* Report issues +* Open pull request with improvements +* Spread the word +* Reach out to me directly at ziishaned@gmail.com or [](https://twitter.com/ziishaned) + +## License + +MIT © [Zeeshan Ahmed](mailto:ziishaned@gmail.com) diff --git a/README.md b/README.md index 5627cfa5..6ea79f70 100644 --- a/README.md +++ b/README.md @@ -11,24 +11,24 @@ ## What is Regular Expression? -> Regular expression is a group of characters or symbols which is used to find a specific pattern from a text. +> Regular expression is a group of characters or symbols which is used to find a specific pattern from a text. -A regular expression is a pattern that is matched against a subject string from left to right. The word "Regular expression" is a -mouthful, you will usually find the term abbreviated as "regex" or "regexp". Regular expression is used for replacing a text within +A regular expression is a pattern that is matched against a subject string from left to right. The word "Regular expression" is a +mouthful, you will usually find the term abbreviated as "regex" or "regexp". Regular expression is used for replacing a text within a string, validating form, extract a substring from a string based upon a pattern match, and so much more. -Imagine you are writing an application and you want to set the rules for when a user chooses their username. We want to -allow the username to contain letters, numbers, underscores and hyphens. We also want to limit the number of +Imagine you are writing an application and you want to set the rules for when a user chooses their username. We want to +allow the username to contain letters, numbers, underscores and hyphens. We also want to limit the number of characters in username so it does not look ugly. We use the following regular expression to validate a username:
"the" => The fat cat sat on the mat. @@ -69,7 +69,7 @@ A regular expression is just a pattern of characters that we use to perform sear [Test the regular expression](https://regex101.com/r/dmRygT/1) -The regular expression `123` matches the string `123`. The regular expression is matched against an input string by comparing each +The regular expression `123` matches the string `123`. The regular expression is matched against an input string by comparing each character in the regular expression to each character in the input string, one after another. Regular expressions are normally case-sensitive so the regular expression `The` would not match the string `the`. @@ -81,8 +81,8 @@ case-sensitive so the regular expression `The` would not match the string `the`. ## 2. Meta Characters -Meta characters are the building blocks of the regular expressions. Meta characters do not stand for themselves but instead are -interpreted in some special way. Some meta characters have a special meaning and are written inside square brackets. +Meta characters are the building blocks of the regular expressions. Meta characters do not stand for themselves but instead are +interpreted in some special way. Some meta characters have a special meaning and are written inside square brackets. The meta characters are as follows: |Meta character|Description| @@ -114,8 +114,8 @@ letter `r`. ## 2.2 Character set -Character sets are also called character class. Square brackets are used to specify character sets. Use a hyphen inside a character set to -specify the characters' range. The order of the character range inside square brackets doesn't matter. For example, the regular +Character sets are also called character class. Square brackets are used to specify character sets. Use a hyphen inside a character set to +specify the characters' range. The order of the character range inside square brackets doesn't matter. For example, the regular expression `[Tt]he` means: an uppercase `T` or lowercase `t`, followed by the letter `h`, followed by the letter `e`.@@ -134,8 +134,8 @@ A period inside a character set, however, means a literal period. The regular ex ### 2.2.1 Negated character set -In general, the caret symbol represents the start of the string, but when it is typed after the opening square bracket it negates the -character set. For example, the regular expression `[^c]ar` means: any character except `c`, followed by the character `a`, followed by +In general, the caret symbol represents the start of the string, but when it is typed after the opening square bracket it negates the +character set. For example, the regular expression `[^c]ar` means: any character except `c`, followed by the character `a`, followed by the letter `r`.@@ -146,13 +146,13 @@ the letter `r`. ## 2.3 Repetitions -Following meta characters `+`, `*` or `?` are used to specify how many times a subpattern can occur. These meta characters act -differently in different situations. +Following meta characters `+`, `*` or `?` are used to specify how many times a subpattern can occur. These meta characters act +differently in different situations. ### 2.3.1 The Star -The symbol `*` matches zero or more repetitions of the preceding matcher. The regular expression `a*` means: zero or more repetitions -of preceding lowercase character `a`. But if it appears after a character set or class then it finds the repetitions of the whole +The symbol `*` matches zero or more repetitions of the preceding matcher. The regular expression `a*` means: zero or more repetitions +of preceding lowercase character `a`. But if it appears after a character set or class then it finds the repetitions of the whole character set. For example, the regular expression `[a-z]*` means: any number of lowercase letters in a row.@@ -161,9 +161,9 @@ character set. For example, the regular expression `[a-z]*` means: any number of [Test the regular expression](https://regex101.com/r/7m8me5/1) -The `*` symbol can be used with the meta character `.` to match any string of characters `.*`. The `*` symbol can be used with the -whitespace character `\s` to match a string of whitespace characters. For example, the expression `\s*cat\s*` means: zero or more -spaces, followed by lowercase character `c`, followed by lowercase character `a`, followed by lowercase character `t`, followed by +The `*` symbol can be used with the meta character `.` to match any string of characters `.*`. The `*` symbol can be used with the +whitespace character `\s` to match a string of whitespace characters. For example, the expression `\s*cat\s*` means: zero or more +spaces, followed by lowercase character `c`, followed by lowercase character `a`, followed by lowercase character `t`, followed by zero or more spaces.@@ -185,8 +185,8 @@ letter `c`, followed by at least one character, followed by the lowercase charac ### 2.3.3 The Question Mark -In regular expression the meta character `?` makes the preceding character optional. This symbol matches zero or one instance of -the preceding character. For example, the regular expression `[T]?he` means: Optional the uppercase letter `T`, followed by the lowercase +In regular expression the meta character `?` makes the preceding character optional. This symbol matches zero or one instance of +the preceding character. For example, the regular expression `[T]?he` means: Optional the uppercase letter `T`, followed by the lowercase character `h`, followed by the lowercase character `e`.@@ -203,7 +203,7 @@ character `h`, followed by the lowercase character `e`. ## 2.4 Braces -In regular expression braces that are also called quantifiers are used to specify the number of times that a +In regular expression braces that are also called quantifiers are used to specify the number of times that a character or a group of characters can be repeated. For example, the regular expression `[0-9]{2,3}` means: Match at least 2 digits but not more than 3 ( characters in the range of 0 to 9). @@ -213,7 +213,7 @@ characters in the range of 0 to 9). [Test the regular expression](https://regex101.com/r/juM86s/1) -We can leave out the second number. For example, the regular expression `[0-9]{2,}` means: Match 2 or more digits. If we also remove +We can leave out the second number. For example, the regular expression `[0-9]{2,}` means: Match 2 or more digits. If we also remove the comma the regular expression `[0-9]{3}` means: Match exactly 3 digits.@@ -230,10 +230,10 @@ the comma the regular expression `[0-9]{3}` means: Match exactly 3 digits. ## 2.5 Character Group -Character group is a group of sub-patterns that is written inside Parentheses `(...)`. As we discussed before that in regular expression -if we put a quantifier after a character then it will repeat the preceding character. But if we put quantifier after a character group then +Character group is a group of sub-patterns that is written inside Parentheses `(...)`. As we discussed before that in regular expression +if we put a quantifier after a character then it will repeat the preceding character. But if we put quantifier after a character group then it repeats the whole character group. For example, the regular expression `(ab)*` matches zero or more repetitions of the character "ab". -We can also use the alternation `|` meta character inside character group. For example, the regular expression `(c|g|p)ar` means: lowercase character `c`, +We can also use the alternation `|` meta character inside character group. For example, the regular expression `(c|g|p)ar` means: lowercase character `c`, `g` or `p`, followed by character `a`, followed by character `r`.@@ -244,10 +244,10 @@ We can also use the alternation `|` meta character inside character group. For e ## 2.6 Alternation -In regular expression Vertical bar `|` is used to define alternation. Alternation is like a condition between multiple expressions. Now, -you may be thinking that character set and alternation works the same way. But the big difference between character set and alternation -is that character set works on character level but alternation works on expression level. For example, the regular expression -`(T|t)he|car` means: uppercase character `T` or lowercase `t`, followed by lowercase character `h`, followed by lowercase character `e` +In regular expression Vertical bar `|` is used to define alternation. Alternation is like a condition between multiple expressions. Now, +you may be thinking that character set and alternation works the same way. But the big difference between character set and alternation +is that character set works on character level but alternation works on expression level. For example, the regular expression +`(T|t)he|car` means: uppercase character `T` or lowercase `t`, followed by lowercase character `h`, followed by lowercase character `e` or lowercase character `c`, followed by lowercase character `a`, followed by lowercase character `r`.@@ -272,17 +272,17 @@ expression `(f|c|m)at\.?` means: lowercase letter `f`, `c` or `m`, followed by l ## 2.8 Anchors -In regular expressions, we use anchors to check if the matching symbol is the starting symbol or ending symbol of the -input string. Anchors are of two types: First type is Caret `^` that check if the matching character is the start -character of the input and the second type is Dollar `$` that checks if matching character is the last character of the +In regular expressions, we use anchors to check if the matching symbol is the starting symbol or ending symbol of the +input string. Anchors are of two types: First type is Caret `^` that check if the matching character is the start +character of the input and the second type is Dollar `$` that checks if matching character is the last character of the input string. ### 2.8.1 Caret -Caret `^` symbol is used to check if matching character is the first character of the input string. If we apply the following regular -expression `^a` (if a is the starting symbol) to input string `abc` it matches `a`. But if we apply regular expression `^b` on above -input string it does not match anything. Because in input string `abc` "b" is not the starting symbol. Let's take a look at another -regular expression `^(T|t)he` which means: uppercase character `T` or lowercase character `t` is the start symbol of the input string, +Caret `^` symbol is used to check if matching character is the first character of the input string. If we apply the following regular +expression `^a` (if a is the starting symbol) to input string `abc` it matches `a`. But if we apply regular expression `^b` on above +input string it does not match anything. Because in input string `abc` "b" is not the starting symbol. Let's take a look at another +regular expression `^(T|t)he` which means: uppercase character `T` or lowercase character `t` is the start symbol of the input string, followed by lowercase character `h`, followed by lowercase character `e`.@@ -299,8 +299,8 @@ followed by lowercase character `h`, followed by lowercase character `e`. ### 2.8.2 Dollar -Dollar `$` symbol is used to check if matching character is the last character of the input string. For example, regular expression -`(at\.)$` means: a lowercase character `a`, followed by lowercase character `t`, followed by a `.` character and the matcher +Dollar `$` symbol is used to check if matching character is the last character of the input string. For example, regular expression +`(at\.)$` means: a lowercase character `a`, followed by lowercase character `t`, followed by a `.` character and the matcher must be end of the string.@@ -317,7 +317,7 @@ must be end of the string. ## 3. Shorthand Character Sets -Regular expression provides shorthands for the commonly used character sets, which offer convenient shorthands for commonly used +Regular expression provides shorthands for the commonly used character sets, which offer convenient shorthands for commonly used regular expressions. The shorthand character sets are as follows: |Shorthand|Description| @@ -332,10 +332,10 @@ regular expressions. The shorthand character sets are as follows: ## 4. Lookaround -Lookbehind and lookahead sometimes known as lookaround are specific type of ***non-capturing group*** (Use to match the pattern but not -included in matching list). Lookaheads are used when we have the condition that this pattern is preceded or followed by another certain -pattern. For example, we want to get all numbers that are preceded by `$` character from the following input string `$4.44 and $10.88`. -We will use following regular expression `(?<=\$)[0-9\.]*` which means: get all the numbers which contain `.` character and are preceded +Lookbehind and lookahead sometimes known as lookaround are specific type of ***non-capturing group*** (Use to match the pattern but not +included in matching list). Lookaheads are used when we have the condition that this pattern is preceded or followed by another certain +pattern. For example, we want to get all numbers that are preceded by `$` character from the following input string `$4.44 and $10.88`. +We will use following regular expression `(?<=\$)[0-9\.]*` which means: get all the numbers which contain `.` character and are preceded by `$` character. Following are the lookarounds that are used in regular expressions: |Symbol|Description| @@ -348,11 +348,11 @@ by `$` character. Following are the lookarounds that are used in regular express ### 4.1 Positive Lookahead The positive lookahead asserts that the first part of the expression must be followed by the lookahead expression. The returned match -only contains the text that is matched by the first part of the expression. To define a positive lookahead, parentheses are used. Within -those parentheses, a question mark with equal sign is used like this: `(?=...)`. Lookahead expression is written after the equal sign inside -parentheses. For example, the regular expression `[T|t]he(?=\sfat)` means: optionally match lowercase letter `t` or uppercase letter `T`, +only contains the text that is matched by the first part of the expression. To define a positive lookahead, parentheses are used. Within +those parentheses, a question mark with equal sign is used like this: `(?=...)`. Lookahead expression is written after the equal sign inside +parentheses. For example, the regular expression `[T|t]he(?=\sfat)` means: optionally match lowercase letter `t` or uppercase letter `T`, followed by letter `h`, followed by letter `e`. In parentheses we define positive lookahead which tells regular expression engine to match -`The` or `the` which are followed by the word `fat`. +`The` or `the` which are followed by the word `fat`."[T|t]he(?=\sfat)" => The fat cat sat on the mat. @@ -362,9 +362,9 @@ followed by letter `h`, followed by letter `e`. In parentheses we define positiv ### 4.2 Negative Lookahead -Negative lookahead is used when we need to get all matches from input string that are not followed by a pattern. Negative lookahead -defined same as we define positive lookahead but the only difference is instead of equal `=` character we use negation `!` character -i.e. `(?!...)`. Let's take a look at the following regular expression `[T|t]he(?!\sfat)` which means: get all `The` or `the` words from +Negative lookahead is used when we need to get all matches from input string that are not followed by a pattern. Negative lookahead +defined same as we define positive lookahead but the only difference is instead of equal `=` character we use negation `!` character +i.e. `(?!...)`. Let's take a look at the following regular expression `[T|t]he(?!\sfat)` which means: get all `The` or `the` words from input string that are not followed by the word `fat` precedes by a space character.@@ -375,8 +375,8 @@ input string that are not followed by the word `fat` precedes by a space charact ### 4.3 Positive Lookbehind -Positive lookbehind is used to get all the matches that are preceded by a specific pattern. Positive lookbehind is denoted by -`(?<=...)`. For example, the regular expression `(?<=[T|t]he\s)(fat|mat)` means: get all `fat` or `mat` words from input string that +Positive lookbehind is used to get all the matches that are preceded by a specific pattern. Positive lookbehind is denoted by +`(?<=...)`. For example, the regular expression `(?<=[T|t]he\s)(fat|mat)` means: get all `fat` or `mat` words from input string that are after the word `The` or `the`.@@ -387,8 +387,8 @@ are after the word `The` or `the`. ### 4.4 Negative Lookbehind -Negative lookbehind is used to get all the matches that are not preceded by a specific pattern. Negative lookbehind is denoted by -`(? @@ -399,7 +399,7 @@ are not after the word `The` or `the`. ## 5. Flags -Flags are also called modifiers because they modify the output of a regular expression. These flags can be used in any order or +Flags are also called modifiers because they modify the output of a regular expression. These flags can be used in any order or combination, and are an integral part of the RegExp. |Flag|Description| @@ -410,9 +410,9 @@ combination, and are an integral part of the RegExp. ### 5.1 Case Insensitive -The `i` modifier is used to perform case-insensitive matching. For example, the regular expression `/The/gi` means: uppercase letter -`T`, followed by lowercase character `h`, followed by character `e`. And at the end of regular expression the `i` flag tells the -regular expression engine to ignore the case. As you can see we also provided `g` flag because we want to search for the pattern in +The `i` modifier is used to perform case-insensitive matching. For example, the regular expression `/The/gi` means: uppercase letter +`T`, followed by lowercase character `h`, followed by character `e`. And at the end of regular expression the `i` flag tells the +regular expression engine to ignore the case. As you can see we also provided `g` flag because we want to search for the pattern in the whole input string.@@ -429,9 +429,9 @@ the whole input string. ### 5.2 Global search -The `g` modifier is used to perform a global match (find all matches rather than stopping after the first match). For example, the -regular expression`/.(at)/g` means: any character except new line, followed by lowercase character `a`, followed by lowercase -character `t`. Because we provided `g` flag at the end of the regular expression now it will find every matches from whole input +The `g` modifier is used to perform a global match (find all matches rather than stopping after the first match). For example, the +regular expression`/.(at)/g` means: any character except new line, followed by lowercase character `a`, followed by lowercase +character `t`. Because we provided `g` flag at the end of the regular expression now it will find every matches from whole input string.@@ -448,9 +448,9 @@ string. ### 5.3 Multiline -The `m` modifier is used to perform a multi-line match. As we discussed earlier anchors `(^, $)` are used to check if pattern is +The `m` modifier is used to perform a multi-line match. As we discussed earlier anchors `(^, $)` are used to check if pattern is the beginning of the input or end of the input string. But if we want that anchors works on each line we use `m` flag. For example, the -regular expression `/at(.)?$/gm` means: lowercase character `a`, followed by lowercase character `t`, optionally anything except new +regular expression `/at(.)?$/gm` means: lowercase character `a`, followed by lowercase character `t`, optionally anything except new line. And because of `m` flag now regular expression engine matches pattern at the end of each line in a string.@@ -496,7 +496,7 @@ line. And because of `m` flag now regular expression engine matches pattern at t * Report issues * Open pull request with improvements -* Spread the word +* Spread the word * Reach out to me directly at ziishaned@gmail.com or [](https://twitter.com/ziishaned) ## License From 4158a0385fd02413d1e1575e59e9bf3cea2f8ad6 Mon Sep 17 00:00:00 2001 From: Zeeshan AhmedDate: Wed, 16 Aug 2017 08:26:23 +0500 Subject: [PATCH 003/197] Update translations in README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6ea79f70..20467178 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ ## Translations: * [English](README.md) +* [Spanish](README-es.md) * [中文版](README-cn.md) * [日本語](README-ja.md) From 4ab2af3c4cb24ff10cc6d8271480dc6ff5756fa4 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 08:27:43 +0500 Subject: [PATCH 004/197] Update translations link --- README-cn.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README-cn.md b/README-cn.md index 84cc721f..9769e30a 100644 --- a/README-cn.md +++ b/README-cn.md @@ -6,7 +6,9 @@ ## 翻译: * [English](README.md) +* [Spanish](README-es.md) * [中文版](README-cn.md) +* [日本語](README-ja.md) ## 什么是正则表达式? From fa9da320c9710337c40305ffa66bab9ca2e51b9e Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 08:29:05 +0500 Subject: [PATCH 005/197] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 20467178..5cd85388 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Translations: * [English](README.md) -* [Spanish](README-es.md) +* [Español](README-es.md) * [中文版](README-cn.md) * [日本語](README-ja.md) From 070093d1e6253b716461d1e744c39996118e03cc Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 08:29:24 +0500 Subject: [PATCH 006/197] Update README-es.md --- README-es.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README-es.md b/README-es.md index 24e86439..42a10d2c 100644 --- a/README-es.md +++ b/README-es.md @@ -6,8 +6,9 @@ ## Translations: * [English](README.md) +* [Español](README-es.md) * [中文版](README-cn.md) -* [Español](README-es.md) +* [日本語](README-ja.md) ## What is Regular Expression? > Una expresión regular es un grupo de caracteres o símbolos, los cuales son usados para buscar un patrón específico dentro de un texto. From 8cb2f7d6cdf25bfec66e631c1fe8372ea66db3b7 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 08:29:42 +0500 Subject: [PATCH 007/197] Update README-ja.md --- README-ja.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README-ja.md b/README-ja.md index 991a46e8..ba89c02f 100644 --- a/README-ja.md +++ b/README-ja.md @@ -6,6 +6,7 @@ ## 翻訳 * [English](README.md) +* [Español](README-es.md) * [中文版](README-cn.md) * [日本語](README-ja.md) From 94c90e66c35ad539e472e102dd313fbe612a4df7 Mon Sep 17 00:00:00 2001 From: Alex Sun Date: Wed, 16 Aug 2017 19:38:18 +0800 Subject: [PATCH 008/197] fix format (#55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit replace `~` with `~` to avoid incorrect format --- README-cn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-cn.md b/README-cn.md index 9769e30a..34d42e0f 100644 --- a/README-cn.md +++ b/README-cn.md @@ -206,7 +206,7 @@ ## 2.4 `{}` 号 在正则表达式中 `{}` 是一个量词, 常用来一个或一组字符可以重复出现的次数. -例如, 表达式 `[0-9]{2,3}` 匹配 2~3 位 0~9 的数字. +例如, 表达式 `[0-9]{2,3}` 匹配 2~3 位 0~9 的数字. From 3cb7983839280fd3c1126d77b1b2adff9097f4d8 Mon Sep 17 00:00:00 2001 From: AbelDate: Wed, 16 Aug 2017 19:43:26 +0800 Subject: [PATCH 009/197] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=AF=91=E6=96=87=20(#56)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README-cn.md * Update README-cn.md --- README-cn.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README-cn.md b/README-cn.md index 34d42e0f..97725f6c 100644 --- a/README-cn.md +++ b/README-cn.md @@ -16,8 +16,8 @@ 一个正则表达式是在一个主体字符串中从左到右匹配字符串时的一种样式. -例如"Regular expression"是一个完整的句子, 但我们常使用缩写的术语"regex"或"regexp". -正则表达式可以用来替换文本中的字符串,验证形式,提取字符串等等. +"Regular expression"这个词比较拗口, 我们常使用缩写的术语"regex"或"regexp". +正则表达式可以从一个基础字符串中根据一定的匹配模式替换文本中的字符串、验证表单、提取字符串等等. 想象你正在写一个应用, 然后你想设定一个用户命名的规则, 让用户名包含字符,数字,下划线和连字符,以及限制字符的个数,好让名字看起来没那么丑. 我们使用以下正则表达式来验证一个用户名: From 499de93acd05e4f63a5d45d698595bd571ce799d Mon Sep 17 00:00:00 2001 From: AndyZ Date: Wed, 16 Aug 2017 19:51:08 +0800 Subject: [PATCH 010/197] Something really need to be clarified (#48) * Something really need to be clarified the `+` is tricky * add explanation on the optional ? Thanks for the great project , hope this can help to clarify a bit in Chinese * Change a bit on . some typo corrected --- README-cn.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-cn.md b/README-cn.md index 97725f6c..8306e36d 100644 --- a/README-cn.md +++ b/README-cn.md @@ -261,7 +261,7 @@ 反斜线 `\` 在表达式中用于转码紧跟其后的字符. 用于指定 `{ } [ ] / \ + * . $ ^ | ?` 这些特殊字符. 如果想要匹配这些特殊字符则要在其前面加上反斜线 `\`. -例如 `.` 是用来匹配除换行符外的所有字符的. 如果想要匹配句子中的 `.` 则要写成 `\.`. +例如 `.` 是用来匹配除换行符外的所有字符的. 如果想要匹配句子中的 `.` 则要写成 `\.` 以下这个例子 `\.?`是选择性匹配`.` "(f|c|m)at\.?" => The fat cat sat on the mat. diff --git a/README.md b/README.md index 5cd85388..fa8e6750 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ zero or more spaces. ### 2.3.2 The Plus The symbol `+` matches one or more repetitions of the preceding character. For example, the regular expression `c.+t` means: lowercase -letter `c`, followed by at least one character, followed by the lowercase character `t`. +letter `c`, followed by at least one character, followed by the lowercase character `t`. It needs to be clarified that `t` is the last `t` in the sentence."c.+t" => The fat cat sat on the mat. From 2375040f554549de998b9d22994ab11a44c46caa Mon Sep 17 00:00:00 2001 From: Zeeshan AhmedDate: Wed, 16 Aug 2017 16:55:28 +0500 Subject: [PATCH 011/197] Update README.md --- README.md | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/README.md b/README.md index fa8e6750..31cd31cd 100644 --- a/README.md +++ b/README.md @@ -470,29 +470,6 @@ line. And because of `m` flag now regular expression engine matches pattern at t [Test the regular expression](https://regex101.com/r/E88WE2/1) -## Bonus - -* *Positive Integers*: `^\d+$` -* *Negative Integers*: `^-\d+$` -* *US Phone Number*: `^+?[\d\s]{3,}$` -* *US Phone with code*: `^+?[\d\s]+(?[\d\s]{10,}$` -* *Integers*: `^-?\d+$` -* *Username*: `^[\w.]{4,16}$` -* *Alpha-numeric characters*: `^[a-zA-Z0-9]*$` -* *Alpha-numeric characters with spaces*: `^[a-zA-Z0-9 ]*$` -* *Password*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$` -* *email*: `^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})*$` -* *IPv4 address*: `^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$` -* *Lowercase letters only*: `^([a-z])*$` -* *Uppercase letters only*: `^([A-Z])*$` -* *URL*: `^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$` -* *VISA credit card numbers*: `^(4[0-9]{12}(?:[0-9]{3})?)*$` -* *Date (DD/MM/YYYY)*: `^(0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2}$` -* *Date (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$` -* *Date (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$` -* *MasterCard credit card numbers*: `^(5[1-5][0-9]{14})*$` -* *Hashtags*: Including hashtags with preceding text (abc123#xyz456) or containing white spaces within square brackets (#[foo bar]) : `\S*#(?:\[[^\]]+\]|\S+)` -* *@mentions*: `\B@[a-z0-9_-]+` ## Contribution * Report issues From b266e64b60c7709b5bef96abbb04c07f74478f33 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 16:56:06 +0500 Subject: [PATCH 012/197] Update README-ja.md --- README-ja.md | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/README-ja.md b/README-ja.md index ba89c02f..fe039ead 100644 --- a/README-ja.md +++ b/README-ja.md @@ -503,30 +503,6 @@ [正規表現の動作確認をする](https://regex101.com/r/E88WE2/1) -## おまけ - -* *正の整数*: `^\d+$` -* *負の整数*: `^-\d+$` -* *米国の電話番号*: `^+?[\d\s]{3,}$` -* *コード付きの米国の電話番号*: `^+?[\d\s]+(?[\d\s]{10,}$` -* *整数*: `^-?\d+$` -* *ユーザ名*: `^[\w.]{4,16}$` -* *英数字*: `^[a-zA-Z0-9]*$` -* *スペース込みの英数字*: `^[a-zA-Z0-9 ]*$` -* *パスワード*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$` -* *Eメール*: `^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})*$` -* *IPv4 アドレス*: `^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$` -* *小文字のみ*: `^([a-z])*$` -* *大文字のみ*: `^([A-Z])*$` -* *URL*: `^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$` -* *VISA クレジットカード番号*: `^(4[0-9]{12}(?:[0-9]{3})?)*$` -* *日付 (DD/MM/YYYY)*: `^(0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2}$` -* *日付 (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$` -* *日付 (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$` -* *MasterCard クレジットカード番号*: `^(5[1-5][0-9]{14})*$` -* *ハッシュタグ*: 前の文字列を含む (abc123#xyz456) または角括弧内にスペースを含む (#[foo bar]) : `\S*#(?:\[[^\]]+\]|\S+)` -* *@mentions*: `\B@[a-z0-9_-]+` - ## 貢献する * 課題を発行する From fc0548d940e6512dffb39166939fd14a643065a6 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 16:57:07 +0500 Subject: [PATCH 013/197] Update README-es.md --- README-es.md | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/README-es.md b/README-es.md index 42a10d2c..64ca5965 100644 --- a/README-es.md +++ b/README-es.md @@ -449,29 +449,6 @@ el motor de expresión regular coincide con el patrón al final de cada línea d [Prueba la expresión regular](https://regex101.com/r/E88WE2/1) -## Bonus - -* *Positive Integers*: `^\d+$` -* *Negative Integers*: `^-\d+$` -* *US Phone Number*: `^+?[\d\s]{3,}$` -* *US Phone with code*: `^+?[\d\s]+(?[\d\s]{10,}$` -* *Integers*: `^-?\d+$` -* *Username*: `^[\w.]{4,16}$` -* *Alpha-numeric characters*: `^[a-zA-Z0-9]*$` -* *Alpha-numeric characters with spaces*: `^[a-zA-Z0-9 ]*$` -* *Password*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$` -* *email*: `^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})*$` -* *IPv4 address*: `^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$` -* *Lowercase letters only*: `^([a-z])*$` -* *Uppercase letters only*: `^([A-Z])*$` -* *URL*: `^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$` -* *VISA credit card numbers*: `^(4[0-9]{12}(?:[0-9]{3})?)*$` -* *Date (DD/MM/YYYY)*: `^(0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2}$` -* *Date (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$` -* *Date (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$` -* *MasterCard credit card numbers*: `^(5[1-5][0-9]{14})*$` -* *Hashtags*: Including hashtags with preceding text (abc123#xyz456) or containing white spaces within square brackets (#[foo bar]) : `\S*#(?:\[[^\]]+\]|\S+)` -* *@mentions*: `\B@[a-z0-9_-]+` ## Contribution * Report issues From 9368d09838e4e39a350b48505cb0b8fb331503e2 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Wed, 16 Aug 2017 16:57:45 +0500 Subject: [PATCH 014/197] Update README-cn.md --- README-cn.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/README-cn.md b/README-cn.md index 8306e36d..e075d23a 100644 --- a/README-cn.md +++ b/README-cn.md @@ -462,27 +462,6 @@ [在线练习](https://regex101.com/r/E88WE2/1) -## 额外补充 - -* *正整数*: `^\d+$` -* *负整数*: `^-\d+$` -* *手机国家号*: `^+?[\d\s]{3,}$` -* *手机号*: `^+?[\d\s]+(?[\d\s]{10,}$` -* *整数*: `^-?\d+$` -* *用户名*: `^[\w\d_.]{4,16}$` -* *数字和英文字母*: `^[a-zA-Z0-9]*$` -* *数字和英文字母和空格*: `^[a-zA-Z0-9 ]*$` -* *密码*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$` -* *邮箱*: `^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})*$` -* *IP4 地址*: `^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$` -* *纯小写字母*: `^([a-z])*$` -* *纯大写字母*: `^([A-Z])*$` -* *URL*: `^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$` -* *VISA 信用卡号*: `^(4[0-9]{12}(?:[0-9]{3})?)*$` -* *日期 (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$` -* *日期 (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$` -* *MasterCard 信用卡号*: `^(5[1-5][0-9]{14})*$` - ## 贡献 * 报告问题 From ea270ac1e399fc50b1905adf359a577bbbc2e2cf Mon Sep 17 00:00:00 2001 From: chroju Date: Thu, 17 Aug 2017 01:09:39 +0900 Subject: [PATCH 015/197] Fix typos (#57) --- README-ja.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README-ja.md b/README-ja.md index fe039ead..523928ea 100644 --- a/README-ja.md +++ b/README-ja.md @@ -189,7 +189,7 @@ シンボル `+` は直前の文字が 1 個以上続くパターンにマッチします。 例えば `c.+t` という正規表現は小文字の `c` の後に -任意の 1 文字が続き、さらに `t` が続くことを意味します。 +任意の 1 文字以上が続き、さらに `t` が続くことを意味します。 "c.+t" => The fat cat sat on the mat. @@ -342,7 +342,7 @@ 正規表現ではよく使われる文字集合に対して短縮表記が提供されており、 便利なショートカットとして使用できます。 -省略表記には次のようなものがあります。 +短縮表記には次のようなものがあります。 |短縮表記|説明 | |:------:|-----------------------------------| @@ -441,7 +441,7 @@ ### 5.1 大文字・小文字を区別しない -修飾子 `i` は大文字・小文字を区別しなくないときに使用します。 +修飾子 `i` は大文字・小文字を区別したくないときに使用します。 例えば `/The/gi` という正規表現は大文字の `T` の後に小文字の `h`, `e` が続くという意味ですが、 最後の `i` で大文字・小文字を区別しない設定にしています。 文字列内の全マッチ列を検索したいのでフラグ `g` も渡しています。 @@ -505,7 +505,7 @@ ## 貢献する -* 課題を発行する +* イシューを発行する * 修正をプルリクエストする * ドキュメントを普及させる * 作者に直接連絡を取る: ziishaned@gmail.com または [](https://twitter.com/ziishaned) From e698d5da285e08426f01d1bf49b627b3ef1403f8 Mon Sep 17 00:00:00 2001 From: MayurDate: Thu, 17 Aug 2017 15:58:54 +0530 Subject: [PATCH 016/197] FIX typo in Escaping special character section (#63) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 31cd31cd..3fde9403 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ or lowercase character `c`, followed by lowercase character `a`, followed by low ## 2.7 Escaping special character -Backslash `\` is used in regular expression to escape the next character. This allows to to specify a symbol as a matching character +Backslash `\` is used in regular expression to escape the next character. This allows us to specify a symbol as a matching character including reserved characters `{ } [ ] / \ + * . $ ^ | ?`. To use a special character as a matching character prepend `\` before it. For example, the regular expression `.` is used to match any character except newline. Now to match `.` in an input string the regular expression `(f|c|m)at\.?` means: lowercase letter `f`, `c` or `m`, followed by lowercase character `a`, followed by lowercase letter From 9483a3fa16268b43979e5428db5b80a6663be09f Mon Sep 17 00:00:00 2001 From: Sahib Yar Date: Thu, 17 Aug 2017 15:29:42 +0500 Subject: [PATCH 017/197] deleted the bonus from table of contents (#62) As you now you have removed the bonus section, which contained the examples, the bonus tag should be removed from the table of contents also. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3fde9403..ece50f70 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ contains uppercase letter and also it is too short. - [Case Insensitive](#51-case-insensitive) - [Global search](#52-global-search) - [Multiline](#53-multiline) -- [Bonus](#bonus) ## 1. Basic Matchers From 7ddb3f6bf5556aa62d67ab6fee8fb4091ee5a9ab Mon Sep 17 00:00:00 2001 From: Allan Date: Fri, 18 Aug 2017 10:11:36 +0800 Subject: [PATCH 018/197] Add some compatible character set (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改一处错别字 添加部分简写字符集 --- README-cn.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README-cn.md b/README-cn.md index e075d23a..2fbcee53 100644 --- a/README-cn.md +++ b/README-cn.md @@ -277,7 +277,7 @@ `^` 用来检查匹配的字符串是否在所匹配字符串的开头. -例如, 在 `abc` 中使用表达式 `^a` 会得到结果 `a`. 但如果使用 `^b` 将匹配不到任何结果. 应为在字符串 `abc` 中并不是以 `b` 开头. +例如, 在 `abc` 中使用表达式 `^a` 会得到结果 `a`. 但如果使用 `^b` 将匹配不到任何结果. 因为在字符串 `abc` 中并不是以 `b` 开头. 例如, `^(T|t)he` 匹配以 `The` 或 `the` 开头的字符串. @@ -324,6 +324,12 @@ |\D|匹配非数字: `[^\d]`| |\s|匹配所有空格字符, 等同于: `[\t\n\f\r\p{Z}]`| |\S|匹配所有非空格字符: `[^\s]`| +|\f|匹配一个换页符| +|\n|匹配一个换行符| +|\r|匹配一个回车符| +|\t|匹配一个制表符| +|\v|匹配一个垂直制表符| +|\p|匹配 CR/LF (等同于 `\r\n`),用来匹配 DOS 行终止符| ## 4. 前后关联约束(前后预查) From e67ac5d408e36e8403b3682548a0c41e3e39bec9 Mon Sep 17 00:00:00 2001 From: Loic Humbert Date: Fri, 18 Aug 2017 18:16:07 +0200 Subject: [PATCH 019/197] French translation (#59) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * created file for translation * Added french link * Intro translated * Intro translated * §1 * §2 * Titles translated * §2.1 * Fixed tick issue in title star * Fixed tick issue in title star * §2.2 * Fixed multilignes link * Organized language choice * §2.2.1 * 2.3 => 2.3.1 * §2.3.2 * §2.3.3 * §2.7 * 2.4 => 2.7 * 2.8.1 * 2.8.2 => 4 * 4.2 => 4.3 * 4.4 * changed 'Recherche globale' to 'Correspondance globale' * 5.1 * 5 * 5.1 * 5.3 * FINISHED git commit -am 5.3git commit -am 5.3git commit -am 5.3 FUCK YEAH git commit -am 5.3git commit -am 5.3git commit -am 5.3! :DDD * corrected typos * changed modèle for schéma * corrected typo * corrected typo * corrected typo * corrected typo * corrected typo * corrected typo * corrected typo * corrected typo * corrected typo * corrected typo --- README-cn.md | 21 +-- README-es.md | 3 +- README-fr.md | 468 +++++++++++++++++++++++++++++++++++++++++++++++++++ README-ja.md | 3 +- README.md | 4 +- 5 files changed, 486 insertions(+), 13 deletions(-) create mode 100644 README-fr.md diff --git a/README-cn.md b/README-cn.md index 2fbcee53..57b0b34f 100644 --- a/README-cn.md +++ b/README-cn.md @@ -6,12 +6,13 @@ ## 翻译: * [English](README.md) -* [Spanish](README-es.md) +* [Español](README-es.md) +* [Français](README-fr.md) * [中文版](README-cn.md) * [日本語](README-ja.md) ## 什么是正则表达式? - + > 正则表达式是一组由字母和符号组成的特殊文本, 它可以用来从文本中找出满足你想要的格式的句子. @@ -69,7 +70,7 @@ 例如: 一个正则表达式 `the`, 它表示一个规则: 由字母`t`开始,接着是`h`,再接着是`e`. -"the" => The fat cat sat on the mat. +"the" => The fat cat sat on the mat.[在线练习](https://regex101.com/r/dmRygT/1) @@ -106,7 +107,7 @@ ## 2.1 点运算符 `.` -`.`是元字符中最简单的例子. +`.`是元字符中最简单的例子. `.`匹配任意单个字符, 但不匹配换行符. 例如, 表达式`.ar`匹配一个任意字符后面跟着是`a`和`r`的字符串. @@ -152,7 +153,7 @@ ## 2.3 重复次数 -后面跟着元字符 `+`, `*` or `?` 的, 用来指定匹配子模式的次数. +后面跟着元字符 `+`, `*` or `?` 的, 用来指定匹配子模式的次数. 这些元字符在不同的情况下有着不同的意思. ### 2.3.1 `*` 号 @@ -218,7 +219,7 @@ 我们可以省略第二个参数. 例如, `[0-9]{2,}` 匹配至少两位 0~9 的数字. -如果逗号也省略掉则表示重复固定的次数. +如果逗号也省略掉则表示重复固定的次数. 例如, `[0-9]{3}` 匹配3位数字@@ -353,7 +354,7 @@ `?=...` 前置约束(存在), 表示第一部分表达式必须跟在 `?=...`定义的表达式之后. 返回结果只瞒住第一部分表达式. -定义一个前置约束(存在)要使用 `()`. 在括号内部使用一个问号和等号: `(?=...)`. +定义一个前置约束(存在)要使用 `()`. 在括号内部使用一个问号和等号: `(?=...)`. 前置约束的内容写在括号中的等号后面. 例如, 表达式 `[T|t]he(?=\sfat)` 匹配 `The` 和 `the`, 在括号中我们又定义了前置约束(存在) `(?=\sfat)` ,即 `The` 和 `the` 后面紧跟着 `(空格)fat`. @@ -367,7 +368,7 @@ ### 4.2 `?!...` 前置约束-排除 前置约束-排除 `?!` 用于筛选所有匹配结果, 筛选条件为 其后不跟随着定义的格式 -`前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`. +`前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`. 表达式 `[T|t]he(?!\sfat)` 匹配 `The` 和 `the`, 且其后不跟着 `(空格)fat`. @@ -429,7 +430,7 @@ ### 5.2 全局搜索 (Global search) -修饰符 `g` 常用语执行一个全局搜索匹配, 即(不仅仅返回第一个匹配的, 而是返回全部). +修饰符 `g` 常用语执行一个全局搜索匹配, 即(不仅仅返回第一个匹配的, 而是返回全部). 例如, 表达式 `/.(at)/g` 表示搜索 任意字符(除了换行) + `at`, 并返回全部结果.+ +[Essayer l'expression régulière](https://regex101.com/r/8Efx5G/1) + +## 5. Drapeaux + +Les drapeaux sont aussi appelés modifieurs car ils modifient la sortie d'une expression régulière. Ces drapeaux peuvent être utilisés +dans n'importe quel ordre et combinaison et font partie intégrante de la RegExp. + +|Drapeau|Description| +|:----:|----| +|i|Insensible à la casse: Définit que la correspondance sera insensible à la casse.| +|g|Recherche globale: Recherche la correspondance dans la string entière.| +|m|Multiligne: Meta-caractère ancre qui agit sur toutes les lignes.| + +### 5.1 Insensible à la casse + +Le modifieur `i` est utilisé pour faire une correspondance insensible à la casse. Par exemple, l'expression régulière `/The/gi` signifie: la lettre +`T` majuscule, suivie par le caractère `h` minscule, suivi par le caractère `e` minuscule. Et à la fin de l'expression régulière, le drapeau `i` dit au +moteur d'expression régulière d'ignorer la casse. Comme vous pouvez le voir, nous mettons aussi un drapeau `g` parce que nous voulons chercher le schéma dans +la string entière. + +@@ -446,7 +447,7 @@ ### 5.3 多行修饰符 (Multiline) -多行修饰符 `m` 常用语执行一个多行匹配. +多行修饰符 `m` 常用语执行一个多行匹配. 像之前介绍的 `(^,$)` 用于检查格式是否是在待检测字符串的开头或结尾. 但我们如果想要它在每行的开头和结尾生效, 我们需要用到多行修饰符 `m`. diff --git a/README-es.md b/README-es.md index 64ca5965..6988406c 100644 --- a/README-es.md +++ b/README-es.md @@ -6,7 +6,8 @@ ## Translations: * [English](README.md) -* [Español](README-es.md) +* [Español](README-es.md) +* [Français](README-fr.md) * [中文版](README-cn.md) * [日本語](README-ja.md) diff --git a/README-fr.md b/README-fr.md new file mode 100644 index 00000000..931abd1b --- /dev/null +++ b/README-fr.md @@ -0,0 +1,468 @@ ++ +[Essayer l'expression régulière](https://regex101.com/r/IDDARt/1) + +### 4.2 Recherche en avant négative + +La recherche en avant négative est utilisée quand nous avons besoin de trouver une string qui n'est pas suivie d'un schéma. La recherche en avant négative +est définie de la même manière que la recherche en avant positive mais la seule différence est qu'à la place du signe égual `=` nous utilisons le caractère de négation `!` +i.e. `(?!...)`. Regardons l'expression régulière suivante `[T|t]he(?!\sfat)` qui signifie: trouve tous les mots `The` ou `the` de la string +qui ne sont pas suivis du mot `fat` précédé d'un espace. + +
++
+
+ +## Traductions: + +* [English](README.md) +* [Español](README-es.md) +* [Français](README-fr.md) +* [中文版](README-cn.md) +* [日本語](README-ja.md) + +## Qu'est-ce qu'une expression régulière? + +> Une expression régulière est un groupement de caractères ou symboles utilisés pour trouver un schéma spécifique dans un texte. + +Une expression régulière est un schéma qui est comparée à une chaîne de caractères de gauche à droite. Le mot "Expression régulière" +est un terme entier, souvent abrégé par "regex" ou "regexp". Une expression régulière est utilisée pour remplacer un texte à l'intérieur +d'une *string* (une chaîne de caractères), valider un formulaire, extraire une portion de string basée sur un schéma, et bien plus encore. + +Imaginons que nous écrivons une application et que nous voulons définir des règles pour le choix d'un pseudonyme. Nous voulons autoriser +le pseudonyme à contenir des lettres, des nombres, des underscores et des traits d'union. Nous voulons aussi limiter le nombre +de caractères dans le pseudonyme pour qu'il n'ait pas l'air moche. Nous utilisons l'expression régulière suivante pour valider un pseudonyme: +
++
+ +L'expression régulière ci-dessus peut accepter les strings `john_doe`, `jo-hn_doe` et `john12_as`. Ça ne fonctionne pas avec `Jo` car +cette string contient une lettre majuscule et elle est trop courte. + +## Table des matières + +- [Introduction](#1-introduction) +- [Meta-caractères](#2-meta-caractères) + - [Full stop](#21-full-stop) + - [Inclusion de caractères](#22-inclusion-de-caractères) + - [Exclusion de caractères](#221-exclusion-de-caractères) + - [Répétitions](#23-répétitions) + - [Astérisque](#231-Asterisque) + - [Le Plus](#232-le-plus) + - [Le Point d'Interrogation](#233-le-point-d'interrogation) + - [Accolades](#24-accolades) + - [Groupement de caractères](#25-groupement-de-caractères) + - [Alternation](#26-alternation) + - [Caractère d'échappement](#27-caractère-d'échappement) + - [Ancres](#28-ancres) + - [Circonflexe](#281-circonflexe) + - [Dollar](#282-dollar) +- [Liste de caractères abrégés](#3-liste-de-caractères-abrégés) +- [Recherche](#4-recherche) + - [Recherche avant positive](#41-recherche-avant-positive) + - [Recherche avant négative](#42-recherche-avant-négative) + - [Recherche arrière positive](#43-recherche-arrière-positive) + - [Recherche arrière négative](#44-recherche-arrière-négative) +- [Drapeaux](#5-drapeaux) + - [Insensible à la casse](#51-insensible-à-la-casse) + - [Correspondance globale](#52-recherche-globale) + - [Multilignes](#53-multilignes) + +## 1. Introduction + +Une expression régulière est un schéma de caractères utilisés pour effectuer une recherche dans un text. +Par exemple, l'expression régulière `the` signifie: la lettre `t`, suivie de la lettre `h`, suivie de la lettre `e`. + ++
+"the" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/dmRygT/1) + +L'expression régulière `123` coïncide à la chaîne `123`. Chaque caractère de l'expression régulière est comparée à la chaine passée en entrée, caractère par caractère. Les expressions régulières sont normalement sensibles à la casse, donc l'expression régulière `The` ne va pas coïncider à la chaine de caractère `the`. + ++"The" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/1paXsy/1) + +## 2. Meta-caractères + +Les meta-caractères sont les bloques de construction des expressions régulières. Les meta-caractères sont interprétés de manière particulière. Certains meta-caractères ont des significations spéciales et sont écrits entre crochets. +Significations des meta-caractères: + +|Meta-caractère|Description| +|:----:|----| +|.|Un point coïncide avec n'importe quel caractère unique à part le retour à la ligne.| +|[ ]|Classe de caractères. Coïncide avec n'importe quels caractères entre crochets.| +|[^ ]|Négation de classe de caractère. Coïncide avec n'importe quels caractères qui n'est pas entre les crochets.| +|*|Coïncide avec 0 ou plus répétitions du caractère précédent.| +|+|Coïncide avec 1 ou plus répétitions du caractère précédent.| +|?|Rend le caractère précédent optionnel.| +|{n,m}|Accolades. Coïncide avec au moins "n" mais pas plus que "m" répétition(s) du caractère précédent.| +|(xyz)|Groupe de caractères. Coïncide avec les caractères "xyz" dans l'ordre exact.| +|||Alternation (ou). Coïncide soit avec le caractère avant ou après le symbol.| +|\|Échappe le prochain caractère. Cela permet de faire coïncider des caractères réservés tels que[ ] ( ) { } . * + ? ^ $ \ |
| +|^|Coïncide avec le début de la chaîne de caractères.| +|$|Coïncide avec la fin de la chaîne de caractères.| + +## 2.1 Full stop + +Le full stop `.` est l'exemple le plus simple d'un meta-caratère. Le `.` coïncide avec n'importe quel caractère unique, mais ne coïncide pas avec les caractères de retour ou de nouvelle ligne. Par exemple, l'expression régulière `.ar` signifie: n'importe quel caractère suivi par la lettre `a`, suivie par la lettre `r`. + ++".ar" => The car parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/xc9GkU/1) + +## 2.2 Inclusions de caractères + +Les inclusions de caractères sont également appelées classes de caractères. Les crochets sont utilisés pour spécifier les inclusions de caractères. Un trait d'union utilisé dans une inclusion de caractères permet de définir une gamme de caractères. L'ordre utilisé dans la gamme de caractère n'a pas d'importance. Par exemple, l'expression régulière `[Tt]he` signifie: un `T` majuscule ou `t` minucule, suivi par la lettre `h`, suivie par la lettre `e`. + ++"[Tt]he" => The car parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/2ITLQ4/1) + +L'utilisation du point dans une inclusion de caractère signifie toutefois un `.` littéral. L'expression régulière `ar[.]` signifie: un `a` minuscule, suivi par la lettre `r` minuscule, suvie par un `.` (point). + ++"ar[.]" => A garage is a good place to park a car. ++ +[Essayer l'expression régulière](https://regex101.com/r/wL3xtE/1) + +### 2.2.1 Exclusion de caractères + +En règle générale, le caractère circonflexe représente le début d'une chaîne de caractères. Néanmoins, lorsqu'il est utilisé après le crochet ouvrant, il permet d'exclure la gamme de caractère(s). Par exemple, l'expression régulière `[^c]ar` signifie: n'importe quel caractère sauf `c`, suivi par la lettre `a`, suivie par la lettre `r`. + ++"[^c]ar" => The car parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/nNNlq3/1) + +## 2.3 Répétitions + +Les meta-caractères suivants `+`, `*` ou `?` sont utilisés pour spécifier combien de fois un sous-schéma peut apparaître. Ces meta-caractères agissent +différemment selon la situation dans laquelle ils sont utilisés. + +### 2.3.1 Astérisque + +Le symbole `*` correspond à zéro ou plus de répétitions du schéma précédent. L'expression régulière `a*` signifie: zéro ou plus de répétitions +du précédent `a` minuscule. Mais si il se trouve après une liste de caractères alors il s'agit de la répétition de la liste entière. +Par exemple, l'expression régulière `[a-z]*` signifie: n'importe combien de lettres minuscules. + ++"[a-z]*" => The car parked in the garage #21. ++ +[Essayer l'expression régulière](https://regex101.com/r/7m8me5/1) + +Le symbole `*` peut être utilisé avec le meta-caractère `.` pour correspondre à n'importe quelle chaîne de caractères `.*`. Le symbole `*` peut être utilisé avec le +caractère espace vide `\s` pour correspondre à une chaîne d'espaces vides. Par exemple, l'expression `\s*cat\s*` signifie: zéro ou plus +d'espaces, suivis du caractère `c` minuscule, suivi par le caractère `a` minuscule, suivi par le caractère `t` minuscule, suivi par +zéro ou plus d'espaces. + ++"\s*cat\s*" => The fat cat sat on the concatenation. ++ +[Essayer l'expression régulière](https://regex101.com/r/gGrwuz/1) + +### 2.3.2 Le Plus + +Le meta-caractère `+` correspond à une ou plusieurs répétitions du caractère précédent. Par exemple, l'expression régulière `c.+t` signifie: la lettre `c` minuscule, suivie par au moins un caractère, suivi par la lettre `t` minuscule. Le `t` coïncide par conséquent avec le dernier `t` de la phrase. + ++"c.+t" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/Dzf9Aa/1) + +### 2.3.3 Le point d'interrogation + +Le meta-caractère `?` rend le caractère précédent optionel. Ce symbole permet de faire coïncider 0 ou une instance du caractère précédent. Par exemple, l'expression régulière `[T]?he` signifie: la lettre `T` majuscule optionelle, suivie par la lettre `h` minuscule, suivie par la lettre `e` minuscule. + ++"[T]he" => The car is parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/cIg9zm/1) + ++"[T]?he" => The car is parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/kPpO2x/1) + +## 2.4 Accolades + +Dans une expression régulière, les accolades, qui sont aussi appelée quantifieurs, sont utilisées pour spécifier le nombre de fois qu'un +caractère ou un groupe de caractères peut être répété. Par exemple, l'expression régulière `[0-9]{2,3}` signifie: Trouve au moins 2 chiffres mais pas plus de 3 +(caractères dans la gamme de 0 à 9). + ++"[0-9]{2,3}" => The number was 9.9997 but we rounded it off to 10.0. ++ +[Essayer l'expression régulière](https://regex101.com/r/juM86s/1) + +Nous pouvons omettre le second nombre. Par exemple, l'expression régulière `[0-9]{2,}` signifie: Trouve 2 chiffres ou plus. Si nous supprimons aussi +la virgule l'expression régulière `[0-9]{3}` signifie: Trouve exactement 3 chiffres. + ++"[0-9]{2,}" => The number was 9.9997 but we rounded it off to 10.0. ++ +[Essayer l'expression régulière](https://regex101.com/r/Gdy4w5/1) + ++"[0-9]{3}" => The number was 9.9997 but we rounded it off to 10.0. ++ +[Essayer l'expression régulière](https://regex101.com/r/Sivu30/1) + +## 2.5 Groupement de caractères + +Un groupement de caractères est un groupe de sous-schémas qui sont écris dans des parenthèses `(...)`. Nous avions mentionné plus tôt que, dans une expression régulière, +si nous mettons un quantifieur après un caractère alors le caractère précédent sera répété. Mais si nous mettons un quantifieur après un groupement de caractères alors +il répète le groupement de caractères entier. Par exemple, l'expression régulière `(ab)*` trouve zéro ou plus de répétitions des caractères "ab". +Nous pouvons aussi utiliser le meta-caractère d'alternation `|` à l'intérieur d'un groupement. Par exemple, l'expression régulière `(c|g|p)ar` signifie: caractère `c` minuscule, +`g` ou `p`, suivi par le caractère `a`, suivi par le caractère `r`. + ++"(c|g|p)ar" => The car is parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/tUxrBG/1) + +## 2.6 Alternation + +Dans une expression régulière, la barre verticale `|` est utilisée pour définir une alternation. L'alternation est comme une condition entre plusieurs expressions. Maintenant, +nous pourrions penser que la liste de caractères et l'alternation sont la même chose. Mais la grande différence entre une liste de caractères et l'alternation +est que la liste de caractères fonctionne au niveau des caractères mais l'alternation fonctionne au niveau de l'expression. Par exemple, l'expression régulière +`(T|t)he|car` signifie: le caractère `T` majuscule ou `t` minuscule, suivi par le caractère `h` minuscule, suivi par le caractère `e` minuscule +ou le caractère `c` minuscule, suivi par le caractère `a` minuscule, suivit par le caractère `r` minuscule. + ++"(T|t)he|car" => The car is parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/fBXyX0/1) + +## 2.7 Caractère d'échappement + +L'antislash `\` est utilisé dans les expressions régulières pour échapper (ignorer) le caractère suivant. Cela permet de spécifier un symbole comme caractère à trouver +y compris les caractères réservés `{ } [ ] / \ + * . $ ^ | ?`. Pour utiliser un caractère spécial comme caractère à trouver, préfixer `\` avant celui-ci. +Par exemple, l'expression régulière `.` est utilisée pour trouver n'importe quel caractère sauf le retour de ligne. Donc pour trouver `.` dans une string +l'expression régulière `(f|c|m)at\.?` signifie: la lettre minuscule `f`, `c` ou `m`, suivie par le caractère `a` minuscule, suivi par la lettre +`t` minuscule, suivie par le caractère optionnel `.`. + ++"(f|c|m)at\.?" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/DOc5Nu/1) + +## 2.8 Ancres + +Dans les expressions régulières, nous utilisons des ancres pour vérifier si le symbole trouvé est le premier ou dernier symbole de la +string. Il y a 2 types d'ancres: Le premier type est le circonflexe `^` qui cherche si le caractère est le premier +caractère de la string et le deuxième type est le Dollar `$` qui vérifie si le caractère est le dernier caractère de la string. + +### 2.8.1 Circonflexe + +Le symbole circonflexe `^` est utilisé pour vérifier si un caractère est le premier caractère de la string. Si nous appliquons l'expression régulière +suivante `^a` (si a est le premier symbole) à la string `abc`, ça coïncide. Mais si nous appliquons l'expression régulière `^b` sur cette même string, +ça ne coïncide pas. Parce que dans la string `abc` "b" n'est pas le premier symbole. Regardons une autre expression régulière +`^(T|t)he` qui signifie: le caractère `T` majuscule ou le caractère `t` minuscule est le premier symbole de la string, +suivi par le caractère `h` minuscule, suivi par le caractère `e` minuscule. + ++"(T|t)he" => The car is parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/5ljjgB/1) + ++"^(T|t)he" => The car is parked in the garage. ++ +[Essayer l'expression régulière](https://regex101.com/r/jXrKne/1) + +### 2.8.2 Dollar + +Le symbole Dollar `$` est utilisé pour vérifier si un caractère est le dernier caractère d'une string. Par exemple, l'expression régulière +`(at\.)$` signifie: un caractère `a` minuscule, suivi par un caractère `t` minuscule, suivi par un caractère `.` et tout cela doit être +à la fin de la string. + ++"(at\.)" => The fat cat. sat. on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/y4Au4D/1) + ++"(at\.)$" => The fat cat. sat. on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/t0AkOd/1) + +## 3. Liste de caractères abrégés + +Les expressions régulières fournissent des abréviations pour les listes de caractères, ce qui offres des raccourcis pratiques pour +les expressions régulières souvent utilisées. Ces abréviations sont les suivantes: + +|Abréviation|Description| +|:----:|----| +|.|N'importe quel caractère à part le retour de ligne| +|\w|Caractères alphanumériques: `[a-zA-Z0-9_]`| +|\W|Caractères non-alphanumériques: `[^\w]`| +|\d|Chiffres: `[0-9]`| +|\D|Non-numériques: `[^\d]`| +|\s|Espace vide: `[\t\n\f\r\p{Z}]`| +|\S|Tout sauf espace vide: `[^\s]`| + +## 4. Recherche + +La recherche en avant et en arrière sont un type spécifique appelé ***groupe non-capturant*** (utilisés pour trouver un schéma mais pas +pour l'inclure dans la liste de correspondance). Les recherches positives sont utilisées quand nous avons la condition qu'un schéma doit être précédé ou suivi +par un autre schéma. Par exemple, nous voulons tous les chiffres qui sont précédés par le caractère `$` dans la string suivante `$4.44 and $10.88`. +Nous allons utiliser l'expression régulière suivante `(?<=\$)[0-9\.]*` qui signifie: Trouver tous les nombres qui contiennent le caractère `.` et sont précédés +par le caractère `$`. Les recherches que nous trouvons dans les expressions régulières sont les suivantes: + +|Symbole|Description| +|:----:|----| +|?=|Recherche en avant positive| +|?!|Recherche en avant négative| +|?<=|Recherche en arrière positive| +|? +"[T|t]he(?=\sfat)" => The fat cat sat on the mat. ++"[T|t]he(?!\sfat)" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/V32Npg/1) + +### 4.3 Recherche en arrière positive + +La recherche en arrière positive est utilisée pour trouver une string précédée d'un schéma. La recherche en arrière positive se note +`(?<=...)`. Par exemple, l'expression régulière `(?<=[T|t]he\s)(fat|mat)` signifie: trouve tous les mots `fat` ou `mat` de la string qui +se trouve après le mot `The` ou `the`. + ++"(?<=[T|t]he\s)(fat|mat)" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/avH165/1) + +### 4.4 Recherche en arrière négative + +La recherche en arrière négative est utilisée pour trouver une string qui n'est pas précédée d'un schéma. La recherche en arrière négative se note +`(? +"(?<![T|t]he\s)(cat)" => The cat sat on cat. ++"The" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/dpQyf9/1) + ++"/The/gi" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/ahfiuh/1) + +### 5.2 Correspondance globale + +Le modifieur `g` est utilisé pour faire une recherche globale (trouver toutes les strings plutôt que de s'arrêter à la première correspondance ). Par exemple, +l'expression régulière `/.(at)/g` signifie: n'importe quel caractère sauf le retour de ligne, suivi par le caractère `a` minuscule, suivi par le caractère +`t` minuscule. Grâce au drapeau `g` à la fin de l'expression régulière maintenant il trouvera toutes les correspondances de toute la string. + ++"/.(at)/" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/jnk6gM/1) + ++"/.(at)/g" => The fat cat sat on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/dO1nef/1) + +### 5.3 Multilignes + +Le modifieur `m` est utilisé pour trouver une correspondance multiligne. Comme mentionné plus tôt, les ancres `(^, $)` sont utilisés pour vérifier si le schéma +se trouve au début ou à la fin de la string. Mais si nous voulons que l'ancre soit sur chaque ligne nous utilisons le drapeau `m`. Par exemple, l'expression régulière +`/at(.)?$/gm` signifie: le caractère `a` minuscule, suivi par le caractère `t` minuscule, suivi par optionnellement n'importe quel caractère à part le retour de ligne. +Grâce au drapeau `m` maintenant le moteur d'expression régulière trouve le schéma à chaque début de ligne dans la string. + ++"/.at(.)?$/" => The fat + cat sat + on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/hoGMkP/1) + ++"/.at(.)?$/gm" => The fat + cat sat + on the mat. ++ +[Essayer l'expression régulière](https://regex101.com/r/E88WE2/1) + +## Contribution + +* Signaler les problèmes (issues) +* Ouvrir des "pull requests" pour les améliorations +* Parlez-en autour de vous ! +* Contactez moi en anglais à ziishaned@gmail.com ou [](https://twitter.com/ziishaned) + +## License + +MIT © [Zeeshan Ahmed](mailto:ziishaned@gmail.com) diff --git a/README-ja.md b/README-ja.md index 523928ea..bdce2acc 100644 --- a/README-ja.md +++ b/README-ja.md @@ -6,7 +6,8 @@ ## 翻訳 * [English](README.md) -* [Español](README-es.md) +* [Español](README-es.md) +* [Français](README-fr.md) * [中文版](README-cn.md) * [日本語](README-ja.md) diff --git a/README.md b/README.md index ece50f70..7a05ff3b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ ## Translations: * [English](README.md) -* [Español](README-es.md) +* [Español](README-es.md) +* [Français](README-fr.md) * [中文版](README-cn.md) * [日本語](README-ja.md) @@ -260,6 +261,7 @@ or lowercase character `c`, followed by lowercase character `a`, followed by low Backslash `\` is used in regular expression to escape the next character. This allows us to specify a symbol as a matching character including reserved characters `{ } [ ] / \ + * . $ ^ | ?`. To use a special character as a matching character prepend `\` before it. + For example, the regular expression `.` is used to match any character except newline. Now to match `.` in an input string the regular expression `(f|c|m)at\.?` means: lowercase letter `f`, `c` or `m`, followed by lowercase character `a`, followed by lowercase letter `t`, followed by optional `.` character. From 4b641cd11de81057d9f5213766839d296b5c0a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Borbo=C3=ABn?=Date: Sat, 19 Aug 2017 01:59:19 +0200 Subject: [PATCH 020/197] RegExp image in french, typo corrected (#67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Some typo corrected * Typographics rules (as space before :) * égual - égal --- README-fr.md | 86 ++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/README-fr.md b/README-fr.md index 931abd1b..729e2dda 100644 --- a/README-fr.md +++ b/README-fr.md @@ -24,7 +24,7 @@ le pseudonyme à contenir des lettres, des nombres, des underscores et des trait de caractères dans le pseudonyme pour qu'il n'ait pas l'air moche. Nous utilisons l'expression régulière suivante pour valider un pseudonyme:
-
L'expression régulière ci-dessus peut accepter les strings `john_doe`, `jo-hn_doe` et `john12_as`. Ça ne fonctionne pas avec `Jo` car @@ -62,7 +62,7 @@ cette string contient une lettre majuscule et elle est trop courte. ## 1. Introduction Une expression régulière est un schéma de caractères utilisés pour effectuer une recherche dans un text. -Par exemple, l'expression régulière `the` signifie: la lettre `t`, suivie de la lettre `h`, suivie de la lettre `e`. +Par exemple, l'expression régulière `the` signifie : la lettre `t`, suivie de la lettre `h`, suivie de la lettre `e`.+
"the" => The fat cat sat on the mat. @@ -70,7 +70,7 @@ Par exemple, l'expression régulière `the` signifie: la lettre `t`, suivie de l [Essayer l'expression régulière](https://regex101.com/r/dmRygT/1) -L'expression régulière `123` coïncide à la chaîne `123`. Chaque caractère de l'expression régulière est comparée à la chaine passée en entrée, caractère par caractère. Les expressions régulières sont normalement sensibles à la casse, donc l'expression régulière `The` ne va pas coïncider à la chaine de caractère `the`. +L'expression régulière `123` coïncide à la chaîne `123`. Chaque caractère de l'expression régulière est comparée à la chaîne passée en entrée, caractère par caractère. Les expressions régulières sont normalement sensibles à la casse, donc l'expression régulière `The` ne va pas coïncider à la chaîne de caractère `the`."The" => The fat cat sat on the mat. @@ -100,7 +100,7 @@ Significations des meta-caractères: ## 2.1 Full stop -Le full stop `.` est l'exemple le plus simple d'un meta-caratère. Le `.` coïncide avec n'importe quel caractère unique, mais ne coïncide pas avec les caractères de retour ou de nouvelle ligne. Par exemple, l'expression régulière `.ar` signifie: n'importe quel caractère suivi par la lettre `a`, suivie par la lettre `r`. +Le full stop `.` est l'exemple le plus simple d'un meta-caratère. Le `.` coïncide avec n'importe quel caractère unique, mais ne coïncide pas avec les caractères de retour ou de nouvelle ligne. Par exemple, l'expression régulière `.ar` signifie : n'importe quel caractère suivi par la lettre `a`, suivie par la lettre `r`.".ar" => The car parked in the garage. @@ -110,7 +110,7 @@ Le full stop `.` est l'exemple le plus simple d'un meta-caratère. Le `.` coïnc ## 2.2 Inclusions de caractères -Les inclusions de caractères sont également appelées classes de caractères. Les crochets sont utilisés pour spécifier les inclusions de caractères. Un trait d'union utilisé dans une inclusion de caractères permet de définir une gamme de caractères. L'ordre utilisé dans la gamme de caractère n'a pas d'importance. Par exemple, l'expression régulière `[Tt]he` signifie: un `T` majuscule ou `t` minucule, suivi par la lettre `h`, suivie par la lettre `e`. +Les inclusions de caractères sont également appelées classes de caractères. Les crochets sont utilisés pour spécifier les inclusions de caractères. Un trait d'union utilisé dans une inclusion de caractères permet de définir une gamme de caractères. L'ordre utilisé dans la gamme de caractère n'a pas d'importance. Par exemple, l'expression régulière `[Tt]he` signifie : un `T` majuscule ou `t` minuscule, suivi par la lettre `h`, suivie par la lettre `e`."[Tt]he" => The car parked in the garage. @@ -118,7 +118,7 @@ Les inclusions de caractères sont également appelées classes de caractères. [Essayer l'expression régulière](https://regex101.com/r/2ITLQ4/1) -L'utilisation du point dans une inclusion de caractère signifie toutefois un `.` littéral. L'expression régulière `ar[.]` signifie: un `a` minuscule, suivi par la lettre `r` minuscule, suvie par un `.` (point). +L'utilisation du point dans une inclusion de caractère signifie toutefois un `.` littéral. L'expression régulière `ar[.]` signifie : un `a` minuscule, suivi par la lettre `r` minuscule, suivie par un `.` (point)."ar[.]" => A garage is a good place to park a car. @@ -128,7 +128,7 @@ L'utilisation du point dans une inclusion de caractère signifie toutefois un `. ### 2.2.1 Exclusion de caractères -En règle générale, le caractère circonflexe représente le début d'une chaîne de caractères. Néanmoins, lorsqu'il est utilisé après le crochet ouvrant, il permet d'exclure la gamme de caractère(s). Par exemple, l'expression régulière `[^c]ar` signifie: n'importe quel caractère sauf `c`, suivi par la lettre `a`, suivie par la lettre `r`. +En règle générale, le caractère circonflexe représente le début d'une chaîne de caractères. Néanmoins, lorsqu'il est utilisé après le crochet ouvrant, il permet d'exclure la gamme de caractère(s). Par exemple, l'expression régulière `[^c]ar` signifie : n'importe quel caractère sauf `c`, suivi par la lettre `a`, suivie par la lettre `r`."[^c]ar" => The car parked in the garage. @@ -143,9 +143,9 @@ différemment selon la situation dans laquelle ils sont utilisés. ### 2.3.1 Astérisque -Le symbole `*` correspond à zéro ou plus de répétitions du schéma précédent. L'expression régulière `a*` signifie: zéro ou plus de répétitions +Le symbole `*` correspond à zéro ou plus de répétitions du schéma précédent. L'expression régulière `a*` signifie : zéro ou plus de répétitions du précédent `a` minuscule. Mais si il se trouve après une liste de caractères alors il s'agit de la répétition de la liste entière. -Par exemple, l'expression régulière `[a-z]*` signifie: n'importe combien de lettres minuscules. +Par exemple, l'expression régulière `[a-z]*` signifie : n'importe combien de lettres minuscules."[a-z]*" => The car parked in the garage #21. @@ -154,7 +154,7 @@ Par exemple, l'expression régulière `[a-z]*` signifie: n'importe combien de le [Essayer l'expression régulière](https://regex101.com/r/7m8me5/1) Le symbole `*` peut être utilisé avec le meta-caractère `.` pour correspondre à n'importe quelle chaîne de caractères `.*`. Le symbole `*` peut être utilisé avec le -caractère espace vide `\s` pour correspondre à une chaîne d'espaces vides. Par exemple, l'expression `\s*cat\s*` signifie: zéro ou plus +caractère espace vide `\s` pour correspondre à une chaîne d'espaces vides. Par exemple, l'expression `\s*cat\s*` signifie : zéro ou plus d'espaces, suivis du caractère `c` minuscule, suivi par le caractère `a` minuscule, suivi par le caractère `t` minuscule, suivi par zéro ou plus d'espaces. @@ -166,7 +166,7 @@ zéro ou plus d'espaces. ### 2.3.2 Le Plus -Le meta-caractère `+` correspond à une ou plusieurs répétitions du caractère précédent. Par exemple, l'expression régulière `c.+t` signifie: la lettre `c` minuscule, suivie par au moins un caractère, suivi par la lettre `t` minuscule. Le `t` coïncide par conséquent avec le dernier `t` de la phrase. +Le meta-caractère `+` correspond à une ou plusieurs répétitions du caractère précédent. Par exemple, l'expression régulière `c.+t` signifie : la lettre `c` minuscule, suivie par au moins un caractère, suivi par la lettre `t` minuscule. Le `t` coïncide par conséquent avec le dernier `t` de la phrase."c.+t" => The fat cat sat on the mat. @@ -176,7 +176,7 @@ Le meta-caractère `+` correspond à une ou plusieurs répétitions du caractèr ### 2.3.3 Le point d'interrogation -Le meta-caractère `?` rend le caractère précédent optionel. Ce symbole permet de faire coïncider 0 ou une instance du caractère précédent. Par exemple, l'expression régulière `[T]?he` signifie: la lettre `T` majuscule optionelle, suivie par la lettre `h` minuscule, suivie par la lettre `e` minuscule. +Le meta-caractère `?` rend le caractère précédent optionnel. Ce symbole permet de faire coïncider 0 ou une instance du caractère précédent. Par exemple, l'expression régulière `[T]?he` signifie : la lettre `T` majuscule optionnelle, suivie par la lettre `h` minuscule, suivie par la lettre `e` minuscule."[T]he" => The car is parked in the garage. @@ -193,7 +193,7 @@ Le meta-caractère `?` rend le caractère précédent optionel. Ce symbole perme ## 2.4 Accolades Dans une expression régulière, les accolades, qui sont aussi appelée quantifieurs, sont utilisées pour spécifier le nombre de fois qu'un -caractère ou un groupe de caractères peut être répété. Par exemple, l'expression régulière `[0-9]{2,3}` signifie: Trouve au moins 2 chiffres mais pas plus de 3 +caractère ou un groupe de caractères peut être répété. Par exemple, l'expression régulière `[0-9]{2,3}` signifie : trouve au moins 2 chiffres mais pas plus de 3 (caractères dans la gamme de 0 à 9).@@ -202,8 +202,8 @@ caractère ou un groupe de caractères peut être répété. Par exemple, l'expr [Essayer l'expression régulière](https://regex101.com/r/juM86s/1) -Nous pouvons omettre le second nombre. Par exemple, l'expression régulière `[0-9]{2,}` signifie: Trouve 2 chiffres ou plus. Si nous supprimons aussi -la virgule l'expression régulière `[0-9]{3}` signifie: Trouve exactement 3 chiffres. +Nous pouvons omettre le second nombre. Par exemple, l'expression régulière `[0-9]{2,}` signifie : trouve 2 chiffres ou plus. Si nous supprimons aussi +la virgule l'expression régulière `[0-9]{3}` signifie : trouve exactement 3 chiffres."[0-9]{2,}" => The number was 9.9997 but we rounded it off to 10.0. @@ -219,10 +219,10 @@ la virgule l'expression régulière `[0-9]{3}` signifie: Trouve exactement 3 chi ## 2.5 Groupement de caractères -Un groupement de caractères est un groupe de sous-schémas qui sont écris dans des parenthèses `(...)`. Nous avions mentionné plus tôt que, dans une expression régulière, +Un groupement de caractères est un groupe de sous-schémas qui sont écrits dans des parenthèses `(...)`. Nous avions mentionné plus tôt que, dans une expression régulière, si nous mettons un quantifieur après un caractère alors le caractère précédent sera répété. Mais si nous mettons un quantifieur après un groupement de caractères alors il répète le groupement de caractères entier. Par exemple, l'expression régulière `(ab)*` trouve zéro ou plus de répétitions des caractères "ab". -Nous pouvons aussi utiliser le meta-caractère d'alternation `|` à l'intérieur d'un groupement. Par exemple, l'expression régulière `(c|g|p)ar` signifie: caractère `c` minuscule, +Nous pouvons aussi utiliser le meta-caractère d'alternation `|` à l'intérieur d'un groupement. Par exemple, l'expression régulière `(c|g|p)ar` signifie : caractère `c` minuscule, `g` ou `p`, suivi par le caractère `a`, suivi par le caractère `r`.@@ -236,7 +236,7 @@ Nous pouvons aussi utiliser le meta-caractère d'alternation `|` à l'intérieur Dans une expression régulière, la barre verticale `|` est utilisée pour définir une alternation. L'alternation est comme une condition entre plusieurs expressions. Maintenant, nous pourrions penser que la liste de caractères et l'alternation sont la même chose. Mais la grande différence entre une liste de caractères et l'alternation est que la liste de caractères fonctionne au niveau des caractères mais l'alternation fonctionne au niveau de l'expression. Par exemple, l'expression régulière -`(T|t)he|car` signifie: le caractère `T` majuscule ou `t` minuscule, suivi par le caractère `h` minuscule, suivi par le caractère `e` minuscule +`(T|t)he|car` signifie : le caractère `T` majuscule ou `t` minuscule, suivi par le caractère `h` minuscule, suivi par le caractère `e` minuscule ou le caractère `c` minuscule, suivi par le caractère `a` minuscule, suivit par le caractère `r` minuscule.@@ -250,7 +250,7 @@ ou le caractère `c` minuscule, suivi par le caractère `a` minuscule, suivit pa L'antislash `\` est utilisé dans les expressions régulières pour échapper (ignorer) le caractère suivant. Cela permet de spécifier un symbole comme caractère à trouver y compris les caractères réservés `{ } [ ] / \ + * . $ ^ | ?`. Pour utiliser un caractère spécial comme caractère à trouver, préfixer `\` avant celui-ci. Par exemple, l'expression régulière `.` est utilisée pour trouver n'importe quel caractère sauf le retour de ligne. Donc pour trouver `.` dans une string -l'expression régulière `(f|c|m)at\.?` signifie: la lettre minuscule `f`, `c` ou `m`, suivie par le caractère `a` minuscule, suivi par la lettre +l'expression régulière `(f|c|m)at\.?` signifie : la lettre minuscule `f`, `c` ou `m`, suivie par le caractère `a` minuscule, suivi par la lettre `t` minuscule, suivie par le caractère optionnel `.`.@@ -262,7 +262,7 @@ l'expression régulière `(f|c|m)at\.?` signifie: la lettre minuscule `f`, `c` o ## 2.8 Ancres Dans les expressions régulières, nous utilisons des ancres pour vérifier si le symbole trouvé est le premier ou dernier symbole de la -string. Il y a 2 types d'ancres: Le premier type est le circonflexe `^` qui cherche si le caractère est le premier +string. Il y a 2 types d'ancres : Le premier type est le circonflexe `^` qui cherche si le caractère est le premier caractère de la string et le deuxième type est le Dollar `$` qui vérifie si le caractère est le dernier caractère de la string. ### 2.8.1 Circonflexe @@ -270,7 +270,7 @@ caractère de la string et le deuxième type est le Dollar `$` qui vérifie si l Le symbole circonflexe `^` est utilisé pour vérifier si un caractère est le premier caractère de la string. Si nous appliquons l'expression régulière suivante `^a` (si a est le premier symbole) à la string `abc`, ça coïncide. Mais si nous appliquons l'expression régulière `^b` sur cette même string, ça ne coïncide pas. Parce que dans la string `abc` "b" n'est pas le premier symbole. Regardons une autre expression régulière -`^(T|t)he` qui signifie: le caractère `T` majuscule ou le caractère `t` minuscule est le premier symbole de la string, +`^(T|t)he` qui signifie : le caractère `T` majuscule ou le caractère `t` minuscule est le premier symbole de la string, suivi par le caractère `h` minuscule, suivi par le caractère `e` minuscule.@@ -288,7 +288,7 @@ suivi par le caractère `h` minuscule, suivi par le caractère `e` minuscule. ### 2.8.2 Dollar Le symbole Dollar `$` est utilisé pour vérifier si un caractère est le dernier caractère d'une string. Par exemple, l'expression régulière -`(at\.)$` signifie: un caractère `a` minuscule, suivi par un caractère `t` minuscule, suivi par un caractère `.` et tout cela doit être +`(at\.)$` signifie : un caractère `a` minuscule, suivi par un caractère `t` minuscule, suivi par un caractère `.` et tout cela doit être à la fin de la string.@@ -306,24 +306,24 @@ Le symbole Dollar `$` est utilisé pour vérifier si un caractère est le dernie ## 3. Liste de caractères abrégés Les expressions régulières fournissent des abréviations pour les listes de caractères, ce qui offres des raccourcis pratiques pour -les expressions régulières souvent utilisées. Ces abréviations sont les suivantes: +les expressions régulières souvent utilisées. Ces abréviations sont les suivantes : |Abréviation|Description| |:----:|----| |.|N'importe quel caractère à part le retour de ligne| -|\w|Caractères alphanumériques: `[a-zA-Z0-9_]`| -|\W|Caractères non-alphanumériques: `[^\w]`| -|\d|Chiffres: `[0-9]`| -|\D|Non-numériques: `[^\d]`| -|\s|Espace vide: `[\t\n\f\r\p{Z}]`| -|\S|Tout sauf espace vide: `[^\s]`| +|\w|Caractères alphanumériques : `[a-zA-Z0-9_]`| +|\W|Caractères non-alphanumériques : `[^\w]`| +|\d|Chiffres : `[0-9]`| +|\D|Non-numériques : `[^\d]`| +|\s|Espace vide : `[\t\n\f\r\p{Z}]`| +|\S|Tout sauf espace vide : `[^\s]`| ## 4. Recherche La recherche en avant et en arrière sont un type spécifique appelé ***groupe non-capturant*** (utilisés pour trouver un schéma mais pas pour l'inclure dans la liste de correspondance). Les recherches positives sont utilisées quand nous avons la condition qu'un schéma doit être précédé ou suivi par un autre schéma. Par exemple, nous voulons tous les chiffres qui sont précédés par le caractère `$` dans la string suivante `$4.44 and $10.88`. -Nous allons utiliser l'expression régulière suivante `(?<=\$)[0-9\.]*` qui signifie: Trouver tous les nombres qui contiennent le caractère `.` et sont précédés +Nous allons utiliser l'expression régulière suivante `(?<=\$)[0-9\.]*` qui signifie : trouver tous les nombres qui contiennent le caractère `.` et sont précédés par le caractère `$`. Les recherches que nous trouvons dans les expressions régulières sont les suivantes: |Symbole|Description| @@ -337,8 +337,8 @@ par le caractère `$`. Les recherches que nous trouvons dans les expressions ré La recherche en avant assure que la première partie de l'expression soit suivie par l'expression recherchée. La valeur retournée contient uniquement le texte qui correspond à la première partie de l'expression. Pour définir une recherche en avant positive, on utilise -des parenthèses. Entre ces parenthèses, un point d'interrogation avec un signe égual est utilisé comme ça: `(?=...)`. L'expression de recherche -est écrite après le signe égual dans les parenthèses. Par exemple, l'expression régulière `[T|t]he(?=\sfat)` signifie: trouve optionnellement +des parenthèses. Entre ces parenthèses, un point d'interrogation avec un signe égal est utilisé comme cela : `(?=...)`. L'expression de recherche +est écrite après le signe égal dans les parenthèses. Par exemple, l'expression régulière `[T|t]he(?=\sfat)` signifie : trouve optionnellement la lettre `t` minuscule ou la lettre `T` majuscule, suivie par la lettre `h` minuscule, suivie par la lettre `e`. Entre parenthèses nous définissons la recherche en avant positive qui dit quelle est l'expression à chercher. `The` ou `the` qui sont suivies par le mot `fat` précédé d'un espace. @@ -351,8 +351,8 @@ la recherche en avant positive qui dit quelle est l'expression à chercher. `The ### 4.2 Recherche en avant négative La recherche en avant négative est utilisée quand nous avons besoin de trouver une string qui n'est pas suivie d'un schéma. La recherche en avant négative -est définie de la même manière que la recherche en avant positive mais la seule différence est qu'à la place du signe égual `=` nous utilisons le caractère de négation `!` -i.e. `(?!...)`. Regardons l'expression régulière suivante `[T|t]he(?!\sfat)` qui signifie: trouve tous les mots `The` ou `the` de la string +est définie de la même manière que la recherche en avant positive mais la seule différence est qu'à la place du signe égal `=` nous utilisons le caractère de négation `!` +i.e. `(?!...)`. Regardons l'expression régulière suivante `[T|t]he(?!\sfat)` qui signifie : trouve tous les mots `The` ou `the` de la string qui ne sont pas suivis du mot `fat` précédé d'un espace.@@ -364,7 +364,7 @@ qui ne sont pas suivis du mot `fat` précédé d'un espace. ### 4.3 Recherche en arrière positive La recherche en arrière positive est utilisée pour trouver une string précédée d'un schéma. La recherche en arrière positive se note -`(?<=...)`. Par exemple, l'expression régulière `(?<=[T|t]he\s)(fat|mat)` signifie: trouve tous les mots `fat` ou `mat` de la string qui +`(?<=...)`. Par exemple, l'expression régulière `(?<=[T|t]he\s)(fat|mat)` signifie : trouve tous les mots `fat` ou `mat` de la string qui se trouve après le mot `The` ou `the`.@@ -376,7 +376,7 @@ se trouve après le mot `The` ou `the`. ### 4.4 Recherche en arrière négative La recherche en arrière négative est utilisée pour trouver une string qui n'est pas précédée d'un schéma. La recherche en arrière négative se note -`(? @@ -392,14 +392,14 @@ dans n'importe quel ordre et combinaison et font partie intégrante de la RegExp |Drapeau|Description| |:----:|----| -|i|Insensible à la casse: Définit que la correspondance sera insensible à la casse.| -|g|Recherche globale: Recherche la correspondance dans la string entière.| -|m|Multiligne: Meta-caractère ancre qui agit sur toutes les lignes.| +|i|Insensible à la casse : Définit que la correspondance sera insensible à la casse.| +|g|Recherche globale : Recherche la correspondance dans la string entière.| +|m|Multiligne : Meta-caractère ancre qui agit sur toutes les lignes.| ### 5.1 Insensible à la casse -Le modifieur `i` est utilisé pour faire une correspondance insensible à la casse. Par exemple, l'expression régulière `/The/gi` signifie: la lettre -`T` majuscule, suivie par le caractère `h` minscule, suivi par le caractère `e` minuscule. Et à la fin de l'expression régulière, le drapeau `i` dit au +Le modifieur `i` est utilisé pour faire une correspondance insensible à la casse. Par exemple, l'expression régulière `/The/gi` signifie : la lettre +`T` majuscule, suivie par le caractère `h` minuscule, suivi par le caractère `e` minuscule. Et à la fin de l'expression régulière, le drapeau `i` dit au moteur d'expression régulière d'ignorer la casse. Comme vous pouvez le voir, nous mettons aussi un drapeau `g` parce que nous voulons chercher le schéma dans la string entière. @@ -418,7 +418,7 @@ la string entière. ### 5.2 Correspondance globale Le modifieur `g` est utilisé pour faire une recherche globale (trouver toutes les strings plutôt que de s'arrêter à la première correspondance ). Par exemple, -l'expression régulière `/.(at)/g` signifie: n'importe quel caractère sauf le retour de ligne, suivi par le caractère `a` minuscule, suivi par le caractère +l'expression régulière `/.(at)/g` signifie : n'importe quel caractère sauf le retour de ligne, suivi par le caractère `a` minuscule, suivi par le caractère `t` minuscule. Grâce au drapeau `g` à la fin de l'expression régulière maintenant il trouvera toutes les correspondances de toute la string.@@ -437,7 +437,7 @@ l'expression régulière `/.(at)/g` signifie: n'importe quel caractère sauf le Le modifieur `m` est utilisé pour trouver une correspondance multiligne. Comme mentionné plus tôt, les ancres `(^, $)` sont utilisés pour vérifier si le schéma se trouve au début ou à la fin de la string. Mais si nous voulons que l'ancre soit sur chaque ligne nous utilisons le drapeau `m`. Par exemple, l'expression régulière -`/at(.)?$/gm` signifie: le caractère `a` minuscule, suivi par le caractère `t` minuscule, suivi par optionnellement n'importe quel caractère à part le retour de ligne. +`/at(.)?$/gm` signifie : le caractère `a` minuscule, suivi par le caractère `t` minuscule, suivi par optionnellement n'importe quel caractère à part le retour de ligne. Grâce au drapeau `m` maintenant le moteur d'expression régulière trouve le schéma à chaque début de ligne dans la string.From 9968a235b6bc12b95fbfe3fb9a09a4daf7bcdae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Borbo=C3=ABn?=Date: Sat, 19 Aug 2017 11:15:19 +0200 Subject: [PATCH 021/197] Homogenized images (#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * RegExp image for French plus * Some typo corrected * Typographics rules (as space before :) * égual - égal * Images folder added, img src updated * § formatted to 80 lines --- README-es.md | 2 +- README-fr.md | 2 +- README-ja.md | 2 +- README.md | 282 ++++++++++++++++++------------ img/img_original.png | Bin 0 -> 6634 bytes img/regexp-en.png | Bin 0 -> 32144 bytes img/regexp-es.png | Bin 0 -> 34234 bytes img/regexp-fr.png | Bin 0 -> 32922 bytes img/regexp.svg | 397 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 573 insertions(+), 112 deletions(-) create mode 100644 img/img_original.png create mode 100644 img/regexp-en.png create mode 100644 img/regexp-es.png create mode 100644 img/regexp-fr.png create mode 100644 img/regexp.svg diff --git a/README-es.md b/README-es.md index 6988406c..82ec6f66 100644 --- a/README-es.md +++ b/README-es.md @@ -21,7 +21,7 @@ Imagina que estas escribiendo una aplicación y quieres agregar reglas para cuan
-
De la expresión regular anterior, se puede aceptar las cadenas 'john_doe', 'jo-hn_doe' y 'john12_as'. La expresión no coincide con el nombre de usuario 'Jo', porque es una cadena de caracteres que contiene letras mayúsculas y es demasiado corta. diff --git a/README-fr.md b/README-fr.md index 729e2dda..126ca62b 100644 --- a/README-fr.md +++ b/README-fr.md @@ -24,7 +24,7 @@ le pseudonyme à contenir des lettres, des nombres, des underscores et des trait de caractères dans le pseudonyme pour qu'il n'ait pas l'air moche. Nous utilisons l'expression régulière suivante pour valider un pseudonyme:+
![]()
-
L'expression régulière ci-dessus peut accepter les strings `john_doe`, `jo-hn_doe` et `john12_as`. Ça ne fonctionne pas avec `Jo` car diff --git a/README-ja.md b/README-ja.md index bdce2acc..8fb870b2 100644 --- a/README-ja.md +++ b/README-ja.md @@ -27,7 +27,7 @@+
![]()
-
この正規表現によって `john_doe, jo-hn_doe, john12_as` などは許容されることになります。 diff --git a/README.md b/README.md index 7a05ff3b..823ce08c 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,26 @@ > Regular expression is a group of characters or symbols which is used to find a specific pattern from a text. -A regular expression is a pattern that is matched against a subject string from left to right. The word "Regular expression" is a -mouthful, you will usually find the term abbreviated as "regex" or "regexp". Regular expression is used for replacing a text within -a string, validating form, extract a substring from a string based upon a pattern match, and so much more. +A regular expression is a pattern that is matched against a subject string from +left to right. The word "Regular expression" is a mouthful, you will usually +find the term abbreviated as "regex" or "regexp". Regular expression is used for +replacing a text within a string, validating form, extract a substring from a +string based upon a pattern match, and so much more. + +Imagine you are writing an application and you want to set the rules for when a +user chooses their username. We want to allow the username to contain letters, +numbers, underscores and hyphens. We also want to limit the number of characters +in username so it does not look ugly. We use the following regular expression to +validate a username: -Imagine you are writing an application and you want to set the rules for when a user chooses their username. We want to -allow the username to contain letters, numbers, underscores and hyphens. We also want to limit the number of -characters in username so it does not look ugly. We use the following regular expression to validate a username:+
![]()
-
-Above regular expression can accept the strings `john_doe`, `jo-hn_doe` and `john12_as`. It does not match `Jo` because that string -contains uppercase letter and also it is too short. +Above regular expression can accept the strings `john_doe`, `jo-hn_doe` and +`john12_as`. It does not match `Jo` because that string contains uppercase +letter and also it is too short. ## Table of Contents @@ -61,8 +67,9 @@ contains uppercase letter and also it is too short. ## 1. Basic Matchers -A regular expression is just a pattern of characters that we use to perform search in a text. For example, the regular expression -`the` means: the letter `t`, followed by the letter `h`, followed by the letter `e`. +A regular expression is just a pattern of characters that we use to perform +search in a text. For example, the regular expression `the` means: the letter +`t`, followed by the letter `h`, followed by the letter `e`.+
"the" => The fat cat sat on the mat. @@ -70,9 +77,11 @@ A regular expression is just a pattern of characters that we use to perform sear [Test the regular expression](https://regex101.com/r/dmRygT/1) -The regular expression `123` matches the string `123`. The regular expression is matched against an input string by comparing each -character in the regular expression to each character in the input string, one after another. Regular expressions are normally -case-sensitive so the regular expression `The` would not match the string `the`. +The regular expression `123` matches the string `123`. The regular expression is +matched against an input string by comparing each character in the regular +expression to each character in the input string, one after another. Regular +expressions are normally case-sensitive so the regular expression `The` would +not match the string `the`."The" => The fat cat sat on the mat. @@ -82,9 +91,10 @@ case-sensitive so the regular expression `The` would not match the string `the`. ## 2. Meta Characters -Meta characters are the building blocks of the regular expressions. Meta characters do not stand for themselves but instead are -interpreted in some special way. Some meta characters have a special meaning and are written inside square brackets. -The meta characters are as follows: +Meta characters are the building blocks of the regular expressions. Meta +characters do not stand for themselves but instead are interpreted in some +special way. Some meta characters have a special meaning and are written inside +square brackets. The meta characters are as follows: |Meta character|Description| |:----:|----| @@ -103,9 +113,10 @@ The meta characters are as follows: ## 2.1 Full stop -Full stop `.` is the simplest example of meta character. The meta character `.` matches any single character. It will not match return -or newline characters. For example, the regular expression `.ar` means: any character, followed by the letter `a`, followed by the -letter `r`. +Full stop `.` is the simplest example of meta character. The meta character `.` +matches any single character. It will not match return or newline characters. +For example, the regular expression `.ar` means: any character, followed by the +letter `a`, followed by the letter `r`.".ar" => The car parked in the garage. @@ -115,9 +126,11 @@ letter `r`. ## 2.2 Character set -Character sets are also called character class. Square brackets are used to specify character sets. Use a hyphen inside a character set to -specify the characters' range. The order of the character range inside square brackets doesn't matter. For example, the regular -expression `[Tt]he` means: an uppercase `T` or lowercase `t`, followed by the letter `h`, followed by the letter `e`. +Character sets are also called character class. Square brackets are used to +specify character sets. Use a hyphen inside a character set to specify the +characters' range. The order of the character range inside square brackets +doesn't matter. For example, the regular expression `[Tt]he` means: an uppercase +`T` or lowercase `t`, followed by the letter `h`, followed by the letter `e`."[Tt]he" => The car parked in the garage. @@ -125,7 +138,9 @@ expression `[Tt]he` means: an uppercase `T` or lowercase `t`, followed by the le [Test the regular expression](https://regex101.com/r/2ITLQ4/1) -A period inside a character set, however, means a literal period. The regular expression `ar[.]` means: a lowercase character `a`, followed by letter `r`, followed by a period `.` character. +A period inside a character set, however, means a literal period. The regular +expression `ar[.]` means: a lowercase character `a`, followed by letter `r`, +followed by a period `.` character."ar[.]" => A garage is a good place to park a car. @@ -135,9 +150,10 @@ A period inside a character set, however, means a literal period. The regular ex ### 2.2.1 Negated character set -In general, the caret symbol represents the start of the string, but when it is typed after the opening square bracket it negates the -character set. For example, the regular expression `[^c]ar` means: any character except `c`, followed by the character `a`, followed by -the letter `r`. +In general, the caret symbol represents the start of the string, but when it is +typed after the opening square bracket it negates the character set. For +example, the regular expression `[^c]ar` means: any character except `c`, +followed by the character `a`, followed by the letter `r`."[^c]ar" => The car parked in the garage. @@ -147,14 +163,17 @@ the letter `r`. ## 2.3 Repetitions -Following meta characters `+`, `*` or `?` are used to specify how many times a subpattern can occur. These meta characters act -differently in different situations. +Following meta characters `+`, `*` or `?` are used to specify how many times a +subpattern can occur. These meta characters act differently in different +situations. ### 2.3.1 The Star -The symbol `*` matches zero or more repetitions of the preceding matcher. The regular expression `a*` means: zero or more repetitions -of preceding lowercase character `a`. But if it appears after a character set or class then it finds the repetitions of the whole -character set. For example, the regular expression `[a-z]*` means: any number of lowercase letters in a row. +The symbol `*` matches zero or more repetitions of the preceding matcher. The +regular expression `a*` means: zero or more repetitions of preceding lowercase +character `a`. But if it appears after a character set or class then it finds +the repetitions of the whole character set. For example, the regular expression +`[a-z]*` means: any number of lowercase letters in a row."[a-z]*" => The car parked in the garage #21. @@ -162,10 +181,12 @@ character set. For example, the regular expression `[a-z]*` means: any number of [Test the regular expression](https://regex101.com/r/7m8me5/1) -The `*` symbol can be used with the meta character `.` to match any string of characters `.*`. The `*` symbol can be used with the -whitespace character `\s` to match a string of whitespace characters. For example, the expression `\s*cat\s*` means: zero or more -spaces, followed by lowercase character `c`, followed by lowercase character `a`, followed by lowercase character `t`, followed by -zero or more spaces. +The `*` symbol can be used with the meta character `.` to match any string of +characters `.*`. The `*` symbol can be used with the whitespace character `\s` +to match a string of whitespace characters. For example, the expression +`\s*cat\s*` means: zero or more spaces, followed by lowercase character `c`, +followed by lowercase character `a`, followed by lowercase character `t`, +followed by zero or more spaces."\s*cat\s*" => The fat cat sat on the concatenation. @@ -175,8 +196,10 @@ zero or more spaces. ### 2.3.2 The Plus -The symbol `+` matches one or more repetitions of the preceding character. For example, the regular expression `c.+t` means: lowercase -letter `c`, followed by at least one character, followed by the lowercase character `t`. It needs to be clarified that `t` is the last `t` in the sentence. +The symbol `+` matches one or more repetitions of the preceding character. For +example, the regular expression `c.+t` means: lowercase letter `c`, followed by +at least one character, followed by the lowercase character `t`. It needs to be +clarified that `t` is the last `t` in the sentence."c.+t" => The fat cat sat on the mat. @@ -186,9 +209,11 @@ letter `c`, followed by at least one character, followed by the lowercase charac ### 2.3.3 The Question Mark -In regular expression the meta character `?` makes the preceding character optional. This symbol matches zero or one instance of -the preceding character. For example, the regular expression `[T]?he` means: Optional the uppercase letter `T`, followed by the lowercase -character `h`, followed by the lowercase character `e`. +In regular expression the meta character `?` makes the preceding character +optional. This symbol matches zero or one instance of the preceding character. +For example, the regular expression `[T]?he` means: Optional the uppercase +letter `T`, followed by the lowercase character `h`, followed by the lowercase +character `e`."[T]he" => The car is parked in the garage. @@ -204,9 +229,10 @@ character `h`, followed by the lowercase character `e`. ## 2.4 Braces -In regular expression braces that are also called quantifiers are used to specify the number of times that a -character or a group of characters can be repeated. For example, the regular expression `[0-9]{2,3}` means: Match at least 2 digits but not more than 3 ( -characters in the range of 0 to 9). +In regular expression braces that are also called quantifiers are used to +specify the number of times that a character or a group of characters can be +repeated. For example, the regular expression `[0-9]{2,3}` means: Match at least +2 digits but not more than 3 ( characters in the range of 0 to 9)."[0-9]{2,3}" => The number was 9.9997 but we rounded it off to 10.0. @@ -214,8 +240,9 @@ characters in the range of 0 to 9). [Test the regular expression](https://regex101.com/r/juM86s/1) -We can leave out the second number. For example, the regular expression `[0-9]{2,}` means: Match 2 or more digits. If we also remove -the comma the regular expression `[0-9]{3}` means: Match exactly 3 digits. +We can leave out the second number. For example, the regular expression +`[0-9]{2,}` means: Match 2 or more digits. If we also remove the comma the +regular expression `[0-9]{3}` means: Match exactly 3 digits."[0-9]{2,}" => The number was 9.9997 but we rounded it off to 10.0. @@ -231,10 +258,13 @@ the comma the regular expression `[0-9]{3}` means: Match exactly 3 digits. ## 2.5 Character Group -Character group is a group of sub-patterns that is written inside Parentheses `(...)`. As we discussed before that in regular expression -if we put a quantifier after a character then it will repeat the preceding character. But if we put quantifier after a character group then -it repeats the whole character group. For example, the regular expression `(ab)*` matches zero or more repetitions of the character "ab". -We can also use the alternation `|` meta character inside character group. For example, the regular expression `(c|g|p)ar` means: lowercase character `c`, +Character group is a group of sub-patterns that is written inside Parentheses `(...)`. +As we discussed before that in regular expression if we put a quantifier after a +character then it will repeat the preceding character. But if we put quantifier +after a character group then it repeats the whole character group. For example, +the regular expression `(ab)*` matches zero or more repetitions of the character +"ab". We can also use the alternation `|` meta character inside character group. +For example, the regular expression `(c|g|p)ar` means: lowercase character `c`, `g` or `p`, followed by character `a`, followed by character `r`.@@ -245,11 +275,15 @@ We can also use the alternation `|` meta character inside character group. For e ## 2.6 Alternation -In regular expression Vertical bar `|` is used to define alternation. Alternation is like a condition between multiple expressions. Now, -you may be thinking that character set and alternation works the same way. But the big difference between character set and alternation -is that character set works on character level but alternation works on expression level. For example, the regular expression -`(T|t)he|car` means: uppercase character `T` or lowercase `t`, followed by lowercase character `h`, followed by lowercase character `e` -or lowercase character `c`, followed by lowercase character `a`, followed by lowercase character `r`. +In regular expression Vertical bar `|` is used to define alternation. +Alternation is like a condition between multiple expressions. Now, you may be +thinking that character set and alternation works the same way. But the big +difference between character set and alternation is that character set works on +character level but alternation works on expression level. For example, the +regular expression `(T|t)he|car` means: uppercase character `T` or lowercase +`t`, followed by lowercase character `h`, followed by lowercase character `e` or +lowercase character `c`, followed by lowercase character `a`, followed by +lowercase character `r`."(T|t)he|car" => The car is parked in the garage. @@ -259,12 +293,16 @@ or lowercase character `c`, followed by lowercase character `a`, followed by low ## 2.7 Escaping special character -Backslash `\` is used in regular expression to escape the next character. This allows us to specify a symbol as a matching character -including reserved characters `{ } [ ] / \ + * . $ ^ | ?`. To use a special character as a matching character prepend `\` before it. +Backslash `\` is used in regular expression to escape the next character. This +allows us to specify a symbol as a matching character including reserved +characters `{ } [ ] / \ + * . $ ^ | ?`. To use a special character as a matching +character prepend `\` before it. -For example, the regular expression `.` is used to match any character except newline. Now to match `.` in an input string the regular -expression `(f|c|m)at\.?` means: lowercase letter `f`, `c` or `m`, followed by lowercase character `a`, followed by lowercase letter -`t`, followed by optional `.` character. +For example, the regular expression `.` is used to match any character except +newline. Now to match `.` in an input string the regular expression +`(f|c|m)at\.?` means: lowercase letter `f`, `c` or `m`, followed by lowercase +character `a`, followed by lowercase letter `t`, followed by optional `.` +character."(f|c|m)at\.?" => The fat cat sat on the mat. @@ -274,18 +312,22 @@ expression `(f|c|m)at\.?` means: lowercase letter `f`, `c` or `m`, followed by l ## 2.8 Anchors -In regular expressions, we use anchors to check if the matching symbol is the starting symbol or ending symbol of the -input string. Anchors are of two types: First type is Caret `^` that check if the matching character is the start -character of the input and the second type is Dollar `$` that checks if matching character is the last character of the -input string. +In regular expressions, we use anchors to check if the matching symbol is the +starting symbol or ending symbol of the input string. Anchors are of two types: +First type is Caret `^` that check if the matching character is the start +character of the input and the second type is Dollar `$` that checks if matching +character is the last character of the input string. ### 2.8.1 Caret -Caret `^` symbol is used to check if matching character is the first character of the input string. If we apply the following regular -expression `^a` (if a is the starting symbol) to input string `abc` it matches `a`. But if we apply regular expression `^b` on above -input string it does not match anything. Because in input string `abc` "b" is not the starting symbol. Let's take a look at another -regular expression `^(T|t)he` which means: uppercase character `T` or lowercase character `t` is the start symbol of the input string, -followed by lowercase character `h`, followed by lowercase character `e`. +Caret `^` symbol is used to check if matching character is the first character +of the input string. If we apply the following regular expression `^a` (if a is +the starting symbol) to input string `abc` it matches `a`. But if we apply +regular expression `^b` on above input string it does not match anything. +Because in input string `abc` "b" is not the starting symbol. Let's take a look +at another regular expression `^(T|t)he` which means: uppercase character `T` or +lowercase character `t` is the start symbol of the input string, followed by +lowercase character `h`, followed by lowercase character `e`."(T|t)he" => The car is parked in the garage. @@ -301,9 +343,10 @@ followed by lowercase character `h`, followed by lowercase character `e`. ### 2.8.2 Dollar -Dollar `$` symbol is used to check if matching character is the last character of the input string. For example, regular expression -`(at\.)$` means: a lowercase character `a`, followed by lowercase character `t`, followed by a `.` character and the matcher -must be end of the string. +Dollar `$` symbol is used to check if matching character is the last character +of the input string. For example, regular expression `(at\.)$` means: a +lowercase character `a`, followed by lowercase character `t`, followed by a `.` +character and the matcher must be end of the string."(at\.)" => The fat cat. sat. on the mat. @@ -319,8 +362,9 @@ must be end of the string. ## 3. Shorthand Character Sets -Regular expression provides shorthands for the commonly used character sets, which offer convenient shorthands for commonly used -regular expressions. The shorthand character sets are as follows: +Regular expression provides shorthands for the commonly used character sets, +which offer convenient shorthands for commonly used regular expressions. The +shorthand character sets are as follows: |Shorthand|Description| |:----:|----| @@ -334,11 +378,15 @@ regular expressions. The shorthand character sets are as follows: ## 4. Lookaround -Lookbehind and lookahead sometimes known as lookaround are specific type of ***non-capturing group*** (Use to match the pattern but not -included in matching list). Lookaheads are used when we have the condition that this pattern is preceded or followed by another certain -pattern. For example, we want to get all numbers that are preceded by `$` character from the following input string `$4.44 and $10.88`. -We will use following regular expression `(?<=\$)[0-9\.]*` which means: get all the numbers which contain `.` character and are preceded -by `$` character. Following are the lookarounds that are used in regular expressions: +Lookbehind and lookahead sometimes known as lookaround are specific type of +***non-capturing group*** (Use to match the pattern but not included in matching +list). Lookaheads are used when we have the condition that this pattern is +preceded or followed by another certain pattern. For example, we want to get all +numbers that are preceded by `$` character from the following input string +`$4.44 and $10.88`. We will use following regular expression `(?<=\$)[0-9\.]*` +which means: get all the numbers which contain `.` character and are preceded +by `$` character. Following are the lookarounds that are used in regular +expressions: |Symbol|Description| |:----:|----| @@ -349,12 +397,16 @@ by `$` character. Following are the lookarounds that are used in regular express ### 4.1 Positive Lookahead -The positive lookahead asserts that the first part of the expression must be followed by the lookahead expression. The returned match -only contains the text that is matched by the first part of the expression. To define a positive lookahead, parentheses are used. Within -those parentheses, a question mark with equal sign is used like this: `(?=...)`. Lookahead expression is written after the equal sign inside -parentheses. For example, the regular expression `[T|t]he(?=\sfat)` means: optionally match lowercase letter `t` or uppercase letter `T`, -followed by letter `h`, followed by letter `e`. In parentheses we define positive lookahead which tells regular expression engine to match -`The` or `the` which are followed by the word `fat`. +The positive lookahead asserts that the first part of the expression must be +followed by the lookahead expression. The returned match only contains the text +that is matched by the first part of the expression. To define a positive +lookahead, parentheses are used. Within those parentheses, a question mark with +equal sign is used like this: `(?=...)`. Lookahead expression is written after +the equal sign inside parentheses. For example, the regular expression +`[T|t]he(?=\sfat)` means: optionally match lowercase letter `t` or uppercase +letter `T`, followed by letter `h`, followed by letter `e`. In parentheses we +define positive lookahead which tells regular expression engine to match `The` +or `the` which are followed by the word `fat`."[T|t]he(?=\sfat)" => The fat cat sat on the mat. @@ -364,10 +416,13 @@ followed by letter `h`, followed by letter `e`. In parentheses we define positiv ### 4.2 Negative Lookahead -Negative lookahead is used when we need to get all matches from input string that are not followed by a pattern. Negative lookahead -defined same as we define positive lookahead but the only difference is instead of equal `=` character we use negation `!` character -i.e. `(?!...)`. Let's take a look at the following regular expression `[T|t]he(?!\sfat)` which means: get all `The` or `the` words from -input string that are not followed by the word `fat` precedes by a space character. +Negative lookahead is used when we need to get all matches from input string +that are not followed by a pattern. Negative lookahead defined same as we define +positive lookahead but the only difference is instead of equal `=` character we +use negation `!` character i.e. `(?!...)`. Let's take a look at the following +regular expression `[T|t]he(?!\sfat)` which means: get all `The` or `the` words +from input string that are not followed by the word `fat` precedes by a space +character."[T|t]he(?!\sfat)" => The fat cat sat on the mat. @@ -377,9 +432,10 @@ input string that are not followed by the word `fat` precedes by a space charact ### 4.3 Positive Lookbehind -Positive lookbehind is used to get all the matches that are preceded by a specific pattern. Positive lookbehind is denoted by -`(?<=...)`. For example, the regular expression `(?<=[T|t]he\s)(fat|mat)` means: get all `fat` or `mat` words from input string that -are after the word `The` or `the`. +Positive lookbehind is used to get all the matches that are preceded by a +specific pattern. Positive lookbehind is denoted by `(?<=...)`. For example, the +regular expression `(?<=[T|t]he\s)(fat|mat)` means: get all `fat` or `mat` words +from input string that are after the word `The` or `the`."(?<=[T|t]he\s)(fat|mat)" => The fat cat sat on the mat. @@ -389,9 +445,10 @@ are after the word `The` or `the`. ### 4.4 Negative Lookbehind -Negative lookbehind is used to get all the matches that are not preceded by a specific pattern. Negative lookbehind is denoted by -`(? "(?<![T|t]he\s)(cat)" => The cat sat on cat. @@ -401,8 +458,9 @@ are not after the word `The` or `the`. ## 5. Flags -Flags are also called modifiers because they modify the output of a regular expression. These flags can be used in any order or -combination, and are an integral part of the RegExp. +Flags are also called modifiers because they modify the output of a regular +expression. These flags can be used in any order or combination, and are an +integral part of the RegExp. |Flag|Description| |:----:|----| @@ -412,10 +470,12 @@ combination, and are an integral part of the RegExp. ### 5.1 Case Insensitive -The `i` modifier is used to perform case-insensitive matching. For example, the regular expression `/The/gi` means: uppercase letter -`T`, followed by lowercase character `h`, followed by character `e`. And at the end of regular expression the `i` flag tells the -regular expression engine to ignore the case. As you can see we also provided `g` flag because we want to search for the pattern in -the whole input string. +The `i` modifier is used to perform case-insensitive matching. For example, the +regular expression `/The/gi` means: uppercase letter `T`, followed by lowercase +character `h`, followed by character `e`. And at the end of regular expression +the `i` flag tells the regular expression engine to ignore the case. As you can +see we also provided `g` flag because we want to search for the pattern in the +whole input string."The" => The fat cat sat on the mat. @@ -431,10 +491,11 @@ the whole input string. ### 5.2 Global search -The `g` modifier is used to perform a global match (find all matches rather than stopping after the first match). For example, the -regular expression`/.(at)/g` means: any character except new line, followed by lowercase character `a`, followed by lowercase -character `t`. Because we provided `g` flag at the end of the regular expression now it will find every matches from whole input -string. +The `g` modifier is used to perform a global match (find all matches rather than +stopping after the first match). For example, the regular expression`/.(at)/g` +means: any character except new line, followed by lowercase character `a`, +followed by lowercase character `t`. Because we provided `g` flag at the end of +the regular expression now it will find every matches from whole input string."/.(at)/" => The fat cat sat on the mat. @@ -450,10 +511,13 @@ string. ### 5.3 Multiline -The `m` modifier is used to perform a multi-line match. As we discussed earlier anchors `(^, $)` are used to check if pattern is -the beginning of the input or end of the input string. But if we want that anchors works on each line we use `m` flag. For example, the -regular expression `/at(.)?$/gm` means: lowercase character `a`, followed by lowercase character `t`, optionally anything except new -line. And because of `m` flag now regular expression engine matches pattern at the end of each line in a string. +The `m` modifier is used to perform a multi-line match. As we discussed earlier +anchors `(^, $)` are used to check if pattern is the beginning of the input or +end of the input string. But if we want that anchors works on each line we use +`m` flag. For example, the regular expression `/at(.)?$/gm` means: lowercase +character `a`, followed by lowercase character `t`, optionally anything except +new line. And because of `m` flag now regular expression engine matches pattern +at the end of each line in a string."/.at(.)?$/" => The fat diff --git a/img/img_original.png b/img/img_original.png new file mode 100644 index 0000000000000000000000000000000000000000..da1c5fa2ac5822e8bccf3661f0ac720a011fc484 GIT binary patch literal 6634 zcmbVQd0bQXvOke3A|Pn2VUZxA!bM~i2y0LQ5m8WVMGFK4g(^E?3n73T20<_tStLMl zVQFPkAqgZz1tH231WJHlq7XJi2!tiFzk|K+-QM2YzWd(!BcGF*-^~2xcjh37 z;wZmGWeWfR@=izW-2h+%762e6n>T?J%WE?=0H9puWPkA6n112=He&9Xhl%HnLpMJ= zFH)rW4J&GWbtrT*`dRp9=vDV8YFF*X6c=j)Y6YKs6K5JATgR|Je;X-6o_4lOY}Y+d zatT!VKTqO5VF5?bT4pnjO}&@aRcYu_Dp4;B2kw|*Yw|sw#%p*UMUD0vQ84^!ZD|vL z6imvoUwVPRoNpdb(Cyp&nP606BhGxFXS!YZM(RW96XD5Ne8Fx9E~?P@wDG3sbZa2S zG9Bv2P)tNr(DV^MIpi~?5(Dvre6Fbgw*n9GdbN^;xDe~oR~gPIW9hMb9~GP;yYq+B zUYdxDaM5-*Ge+BUtgOUttf2tymJ61f>>PXn;5!HOSY@a>f!2|=BQ1@lKRwroBA;&_ z-2uhgy%NjN%WdW#z_($2hrzW@P`~!V+KlAD@eWa?F+@T4?t~KI0bRTA@!wQ;!j}ll z7PV_p!xpo;E&g(;FDWyY9%7WciWETTL@wOSIeMeJlZTZn8t0Pr4U;F8vH0E0BtJaM zwQQ8HXH!gNKrPcl0^h2u*zOfyR+j>f7)KNKnpoW1Qfj1#U3vQ`?lAv`mgqzxT9^XE zv=l2`4;*8#Rj}?#QUKG~rs5YqIlyi-RnGz4o`1(i(_oft_cHV*Q}sTjffb!bd)5R1 zW?1V~&exkuvt>^5ldXx;fV9$mWAEUx4KI}}Jv}`5x34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~v)|wOr*!t$o zz@IjM?C eFM&y9A+;R{I*dk@u+$3IVVPJvFRvBRAXMtH`3oKVSk(UgVm| zZb}?nGe!rU#g$^$AM_ZU fS%UEbou^F1c7-<@&Zg<(}0P^_Kf8U&HzO~@T!@sLeGEg83+MNtJW`(OKHZGHG_ zeOyxGXb*A$7CmWP^J~Uv6j_q@c(mqXYyTmZUgSbxGHu}EmO8K*cxw?HgAr`uY7bL~ z;g)alD_zNtGLf9evbC9DzC5SCC0&x2d8u8jLxo4^rep36cbQ#cXmx0z+A|wir4{4B zBCD>1{TB{%E4wf$YNGAls5fVe4&3;@pnKn`%CuGO2p`mh?Czf~qsq<}ol{$JpIGom zD3tUJ6dv7oDrO`yVqA3)p+K3)4GJ*_37wG j~IFW#&w YOzWi69QwZXSr>J3aIr5xbnfbZ0WEGq1poj5 literal 0 HcmV?d00001 diff --git a/img/regexp-en.png b/img/regexp-en.png new file mode 100644 index 0000000000000000000000000000000000000000..f2331491b387f1fd9cb7b843fe86893ca7fad475 GIT binary patch literal 32144 zcmdSBc{rADyEc5GLCTaw%2*^qM9EYkLIW~{kg3eG3>6AxC{od2C}W0X$WWP5hSFdj z8Vr$$GDVT;+t1*0+7%AMg9Fwchpq@wRQh=PCE?zOU;#kMlV8W8e4V4AVZM&d9*U zKv5K<#z9qGilX(UD4GoV75Ir<(63_r-!czn4Ly4NIY)0Dihr+iJ!s^C_ji#0Xq1KH zeDK2!o(GP59& 22X|LwS39i`zLncvxAu+K9WjpN<<<;KG~MkT>bsc{ i6XD*Kc#)mFsN!y8;c4gM%%^APWJB$c z6_?r}xx4RV{v*6W{9j+~- zcNY8Si&;+(tfMGCN<($Oo=^ObF5eS+`b#Uvnd#_->4o_p@jZHCIV#F&KWftFeD_Xz z)ScK^#aPSYQit?RLFWybf-%OAdarM+|8{*NQv@Ghc;H3)_#R#*kAM@WR-8I{$!5OH zJlA*N^Vx={J@Rj*d-e<_db|y0p;g5nYu$A=+!QPRY~Z<}Ab>w?)mx%MLq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