Home Backend Development PHP Tutorial PHP正则表达式函数有哪些

PHP正则表达式函数有哪些

Jun 02, 2016 am 11:30 AM
regular

PHP正则表达式函数有:1、“preg_filter”函数;2、“preg_grep”函数;3、“preg_last_error”函数;4、“preg_match”函数;5、“preg_quote”函数等等。

PHP正则表达式函数有哪些

PHP正则表达式函数有哪些?

PHP 正则表达式(PCRE)

正则表达式(regular expression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串、将匹配的子串做替换或者从某个串中取出符合某个条件的子串等。

更多正则表达式的内容可参考我们的:正则表达式 - 教程。

PHP 中我们可以使用 PCRE 扩展来匹配字符串的模式。

PCRE 函数

函数 

preg_filter 执行一个正则表达式搜索和替换

preg_grep 返回匹配模式的数组条目

preg_last_error 返回最后一个PCRE正则执行产生的错误代码

preg_match_all 执行一个全局正则表达式匹配

preg_match 执行一个正则表达式匹配

preg_quote 转义正则表达式字符

preg_replace_callback_array 执行一个正则表达式搜索并且使用一个回调进行替换

preg_replace_callback 执行一个正则表达式搜索并且使用一个回调进行替换

preg_replace 执行一个正则表达式的搜索和替换

preg_split 通过一个正则表达式分隔字符串

更多相关知识,请访问PHP中文网

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to match multiple words or strings using Golang regular expression? How to match multiple words or strings using Golang regular expression? May 31, 2024 am 10:32 AM

How to match multiple words or strings using Golang regular expression?

How to replace a string starting with something with php regular expression How to replace a string starting with something with php regular expression Mar 24, 2023 pm 02:57 PM

How to replace a string starting with something with php regular expression

How to use regular expressions to remove Chinese characters in php How to use regular expressions to remove Chinese characters in php Mar 03, 2023 am 10:12 AM

How to use regular expressions to remove Chinese characters in php

How to use regular matching to remove html tags in php How to use regular matching to remove html tags in php Mar 21, 2023 pm 05:17 PM

How to use regular matching to remove html tags in php

Sharing tips on using PHP regular expressions to implement Chinese replacement function Sharing tips on using PHP regular expressions to implement Chinese replacement function Mar 24, 2024 pm 05:57 PM

Sharing tips on using PHP regular expressions to implement Chinese replacement function

PHP uses regular expressions to verify whether the input data is a number PHP uses regular expressions to verify whether the input data is a number Mar 21, 2023 pm 02:07 PM

PHP uses regular expressions to verify whether the input data is a number

How to verify if a URL is HTTPS protocol using PHP regex How to verify if a URL is HTTPS protocol using PHP regex Jun 24, 2023 am 08:16 AM

How to verify if a URL is HTTPS protocol using PHP regex

How to use regular replacement to fix Chinese in PHP How to use regular replacement to fix Chinese in PHP Mar 21, 2023 am 11:10 AM

How to use regular replacement to fix Chinese in PHP

See all articles