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 Link to comment https://forums.phpfreaks.com/topic/7331-really-simple-question/ 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] Link to comment https://forums.phpfreaks.com/topic/7331-really-simple-question/#findComment-26668 Share on other sites More sharing options...
deadonarrival Posted April 13, 2006 Author Share Posted April 13, 2006 Perfect thanks a lot Link to comment https://forums.phpfreaks.com/topic/7331-really-simple-question/#findComment-26734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.