Home  >  Article  >  Backend Development  >  请问一下php正则表达式

请问一下php正则表达式

WBOY
WBOYOriginal
2016-06-13 12:18:56981browse

请教一下php正则表达式
会员号为11位字母和数字组合,
前三位为“M15”后一位为”M”结尾。英文字母大小写可以忽略

------解决思路----------------------

<br />$str='M15452s8f1M';<br />if(preg_match('/^M15([A-Za-z0-9]{7})M$/i',$str,$m)){<br />	echo 'OK';<br />}else{<br />	echo 'NO';<br />}<br />

Statement:
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