我不敢说这样写完全没问题,但是它很好用,我也一直这么用了,又不对的地方请路过者纠正 谢谢 ?php if(!empty($_REQUEST["act"])) { checkmail(); } function checkmail() { $str = $_POST["mail"]; $check = preg_match("/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]{2,4}$/",$str); if($check) echo "邮件地址正确"; else echo "邮件不正确!"; } ?> div width="500"> form action="emailcheck.php?ac...
本帖最后由 yshihyu 于 2014-10-06 19:37 编辑 [code]+12 -23 +23.456 -236.23 123.0 123 234352345[/code][0-9]+\.[0-9]+|\+\d+|\-\d+|\+[0-9]+\.[0-9]+|\d+ 我这样写好像也是有问题~ , 请问上面数据要怎么写出简洁的正则表达式 thanks
[root@linjianying ~]# cat shell welcome to iphonebar.net iphone belongs me [root@linjianying ~]# grep -E '+me' shell --color welcome to iphonebar.net me 疑问:+表示它前面的字符至少出现1次,为什么me还会被过滤出来呢?me前面没有字符的啊。
本帖最后由 chenzhanyiczy 于 2013-10-31 15:59 编辑 man regex Within a bracket expression, a collating element (a character, a multi-character sequence that collates as if it were a single character, or a collating-sequence name for either) enclosed in "[." and ".]" stands for the sequence of characters of that collating element. The sequence is a single element of the brac...
man regex Within a bracket expression, a collating element (a character, a multi-character sequence that collates as if it were a single character, or a collating-sequence name for either) enclosed in "[." and ".]" stands for the sequence of characters of that collating element. The sequence is a single element of the bracket expression’s list. A bracket expressio...