|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1998-10-29 22:04 UTC] rasmus
[2023-03-06 07:15 UTC] asghhs at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Jun 10 21:00:01 2026 UTC |
eregi("[^a-z0-9\.\-]", "test-ing") returns false eregi("[^a-z0-9\-\.]", "test-ing") returns true Switching the escaped "." and "-" causes the pattern to fail erroneously. The behaviour goes away if you use an inclusive regex (read: lose the "^") here's a short script to test with <? function isValidAddr ($addr) { if(eregi("[^a-z0-9\-\.]",$addr)): return(false); else: return(true); endif; }; echo isValidAddr("Tesdt-jkjk") ? "true" : "false"; ?>