how to use eregi to only allow characters and underscore?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
modpriest
Forum Newbie
Posts: 4
Joined: Tue Feb 26, 2008 9:48 pm

how to use eregi to only allow characters and underscore?

Post by modpriest »

i new to php, how to use eregi to only allow characters and underscore? because http://us.php.net/manual/en/function.eregi.php only show basic usage of eregi! can anyone teach me or show me the code? please help me :? :?
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: how to use eregi to only allow characters and underscore?

Post by Apollo »

Code: Select all

if (!eregi('^[a-z_]*$',$yourString)) die('your string does not fit my needs madam!');
Post Reply