反向引用:对模式单元中捕获的文本内容的引用
UTF8编码下汉字Unicode编码范围: u4e00-u9fa5
捕获的文本储存在临时缓冲区中,缓冲区编号范围为1-99,
反向引用格式为 编号(例如1)
非捕获元字符 "?:" (忽略捕获的这个元字符,缓冲区编号顺移)
| preg_match | int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) |
搜索subject与pattern给定的正则表达式的一个匹配. |
| preg_match_all | int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] ) |
搜索subject中所有匹配pattern给定正则表达式 的匹配结果并且将它们以flag指定顺序输出到matches中. |
| preg_replace | mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] ) |
搜索subject中匹配pattern的部分, 以replacement进行替换。 |
| preg_repalce_callback | mixed preg_replace_callback ( mixed $pattern , callable $callback , mixed $subject [, int $limit = -1 [, int &$count ]] ) |
这个函数的行为除了 可以指定一个 callback 替代 replacement 进行替换 字符串的计算,其他方面等同于 preg_replace()。 |
| preg_filter | mixed preg_filter ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] ) |
preg_filter()等价于preg_replace() 除了它仅仅返回(可能经过转化)与目标匹配的结果. |
| preg_grep | array preg_grep ( string $pattern , array $input [, int $flags = 0 ] ) |
返回给定数组input中与模式pattern 匹配的元素组成的数组. |
| preg_split | array preg_split ( string $pattern , string $subject [, int $limit = -1 [, int $flags = 0 ]] ) |
通过一个正则表达式分隔给定字符串. |
| preg_quote | string preg_quote ( string $str [, string $delimiter = NULL ] ) |
preg_quote()需要参数 str 并向其中 每个正则表达式语法中的字符前增加一个反斜线。 这通常用于你有一些运行时字符串 需要作为正则表达式进行匹配的时候。 |