Home > Backend Development > PHP Tutorial > Regular expression system tutorial (6)_PHP tutorial

Regular expression system tutorial (6)_PHP tutorial

WBOY
Release: 2016-07-13 17:20:49
Original
795 people have browsed it

6. Some examples

正则表达式 说明
/([a-z]+) 1/gi 一个单词连续出现的位置
/(w+)://([^/:]+)(:d*)?([^# ]*)/ 将一个URL解析为协议、域、端口及相对路径
/^(?:Chapter|Section) [1-9][0-9]{0,1}$/ 定位章节的位置
/[-a-z]/ A至z共26个字母再加一个-号。
/ter/ 可匹配chapter,而不能terminal
/Bapt/ 可匹配chapter,而不能aptitude
/Windows(?=95 |98 |NT )/ 可匹配Windows95或Windows98或WindowsNT,当找到一个匹配后,从Windows后面开始进行下一次的检索匹配。

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532536.htmlTechArticle6. Some examples of regular expression description/([a-z]+) 1/gi The position where a word appears continuously /(w+)://([^/:]+)(:d*)?([^# ]*)/ Parses a URL into protocol, domain, port and relative path/^...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template