Re: Wrong Parament count

From: Date: Wed, 22 Oct 2003 08:15:30 +0000
Subject: Re: Wrong Parament count
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-31254@lists.php.net to get a copy of this message
On Wednesday 22 October 2003 14:55, Tonya wrote: > MYSQL and PHP 4.3.3 > > *sigh* I hate eregs and I'm really bad with them :/ > > I have a form that has a field in which the user is supposed to enter an > IRC channel name. IRC channel names begin with a '#'. > > ereg("^#") does not work. I am getting the error "Warning: Wrong > parameter count for ereg()" Jeez, at least make a token effort. See the manual entry for ereg()? It expects at least 2 parameters. Surely you can count past one? And surely the error message is explicit enough? > Can someone give me a working ereg for this?? :) No. But here's a snippet using preg_match(): $input_string = "#ircchannel"; if (preg_match("/^#[a-zA-Z]+/", $input_string) { echo "Looks like an irc channel"; } else { echo "Go check your input"; } What the above checks for is: 1) A line that begins with a hash (#) 2) Followed by one or more letters (non case-sensitive) 3) And nothing else I don't know what letters/symbols/characters constitute a valid IRC channel so you may have to season the above to taste. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db ------------------------------------------ /* The majority of husbands remind me of an orangutang trying to play the violin. -- Honor'e DeBalzac */

« previous php.db (#31254) next »