Introduction to regular expressions_PHP tutorial

WBOY
Release: 2016-07-20 11:05:07
Original
819 people have browsed it

1. Regular expressions
If you have never used regular expressions before, you may not be familiar with this term and concept. They're not as novel as you might think, though.
Remember how files are found on your hard drive. You will definitely use the ? and * characters to help find the file you are looking for. The ? character matches the
single character in the file name, while the * matches one or more characters. A pattern like 'data?.dat' will find the following files:
data1.dat
data2.dat
datax.dat
dataN.dat
If the * character is used instead of the ? character , will expand the number of files found. 'data*.dat' can match all the following file names:
data.dat
data1.dat
data2.dat
data12.dat
datax.dat
dataXYZ.dat
While this method of searching for files is certainly useful, it's also very limited. The limited capabilities of the ? and * wildcards can give you an idea of ​​what regular expressions can do, but regular expressions are much more powerful and flexible.



http://www.bkjia.com/PHPjc/445145.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445145.htmlTechArticle1. Regular Expressions If you have never used regular expressions before, you may not be familiar with this terminology and concept. familiar. They're not as novel as you might think, though. Please think back...
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