3', PHPWEB:'php.cn', settings:'settings', FullScreen:'Full Screen', Speed:'Speed', BrainwashingLoop:'Loop', speedNormal:'Normal', click_to_see:'Click to see full code for direct edit', nextSection:'Next Section', Cancel:'Cancel', Confirm:'Confirm', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de' };

php限制只能输入英文字符和数字的正则表达式

WBOY
Release: 2016-06-20 13:03:41
Original
3098 people have browsed it

php限制只能输入英文字符和数字,正则表达式如下:

<p>$password='abc12';</p>if(!preg_match("/^(([a-z]+[0-9]+)|([0-9]+[a-z]+))[a-z0-9]*$/i",$password)){<br />	echo '密码必须由数字和字母的组合而成';<br /><p>}</p>
Copy after login

php限制只能输入6-15位的英文字符和数字,正则表达式如下:

<p>$password='abc123';</p>$plen=strlen($password);<br />if(!preg_match("/^(([a-z]+[0-9]+)|([0-9]+[a-z]+))[a-z0-9]*$/i",$password)||$plen<6||$plen>15){<br />	echo '密码必须为6-15位的数字和字母的组合';<br />}
Copy after login


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!