Home > Backend Development > PHP Tutorial > php正则表达式 看不懂,请指点解决思路

php正则表达式 看不懂,请指点解决思路

WBOY
Release: 2016-06-13 11:48:30
Original
844 people have browsed it

php正则表达式 看不懂,请指点
从程序代码证找出标示符[A-Za-z_][A-Za-z_0-9]*.

请问如何在代码中中写?我不知道这样的代码如何写?请给个小例子看看。
------解决方案--------------------

<br />[A-Za-z_][A-Za-z_0-9]*<br />
Copy after login

大写A-Z或小写a-z或下划线加上任意数量的大写A-Z或小写a-z或下划线
看看晚上正则的代码 多练习就行了


------解决方案--------------------
preg_match_match('/^[A-Za-z_][A-Za-z_0-9]*.$/',$str,$ret);
print_r($ret);
------解决方案--------------------
手误
preg_match_all('/^[A-Za-z_][A-Za-z_0-9]*.$/',$str,$ret);
print_r($ret);
------解决方案--------------------

引用:
Quote: 引用:

preg_match_match('/^[A-Za-z_][A-Za-z_0-9]*.$/',$str,$ret);
print_r($ret);


请指点,
("/^[A-Za-z]\d{9}$/", $str) 这一句请给我解释下, 两个/ 斜杠什么意思? ^在这里又是什么意思?×.$/是什么意思?

都是正则基础啊,百度下吧。
Related labels:
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