deadonarrival Posted April 13, 2006 Share Posted April 13, 2006 Really simple question here - I just don't remember exacty how to do it. =PAnyway I have a string $username and I want to do a quick error check if the username contains a _ or a -Could anyone give me this line of code please? I thought of using ereg but I'm not too confident in using the function.Thanks~DeadOnArrival Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 13, 2006 Share Posted April 13, 2006 [!--quoteo(post=364484:date=Apr 13 2006, 01:07 PM:name=deadonarrival)--][div class=\'quotetop\']QUOTE(deadonarrival @ Apr 13 2006, 01:07 PM) [snapback]364484[/snapback][/div][div class=\'quotemain\'][!--quotec--]Really simple question here - I just don't remember exacty how to do it. =P[/quote][code]if (preg_match('|[-_]|', $username)) // it contains either a - or a _else // it doesn't contain either[/code] Quote Link to comment Share on other sites More sharing options...
deadonarrival Posted April 13, 2006 Author Share Posted April 13, 2006 Perfect thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.