Home  >  Article  >  Backend Development  >  关于正则表达式的有关问题

关于正则表达式的有关问题

WBOY
WBOYOriginal
2016-06-13 13:51:48886browse

关于正则表达式的问题
请问一下email的正则表达式在POSIX中应该是怎么样的,我写了
eregi( '^([_.0-9a-z])+@([_0-9a-z-])+.([0-9a-z_-.])+ ', "luan78zao@hotmail.com ",$validated);
但是return的是false,是否有错误?   还有在页面显示了
Warning:   eregi()   [function.eregi]:   REG_ERANGE   in   C:\AppServ\www\finalProject\validatePage.php   on   line   8
请问下这个是什么意思。谢谢各位高手

------解决方案--------------------
句点符号匹配所有字符,包括空格、Tab字符甚至换行符.
连字符(“-”)它表示一个范围.
因此要匹配这两个字符要用 "\ "转义
恰当的表达式可以是
eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$ ", 'luan78zao@hotmail.com ',$validated);

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