I stay away from the ereg functions because
they benchmark significantly slower than the
preg equivalent.
Maybe sometimes, but in this instance, no - not on my server. (Sorry, you caught me with my timer testing script up and I had to check this claim out.
For the string:
$username="My UserName is ()()()(";
eregi("[a-z0-9]",$username) clocked in at 1.2222719937563 seconds/100,000
preg_match("/[a-z0-9]+$/i", $username) limped along at 2.6144229918718 seconds/100,000
preg_match("/[\w\d]+$/", $username) took 2.2509840130806 seconds/100,000
Okay, I'm done. puts timer script away