Try this: function for_raul($string){ $returner = false; $line = "Davis, Nathan Ventura" $name = array(); $name = split(",",$line); $cont = count($name); if ($cont==2) $returner = true; return $returner; } let me know if this works for you! --- In php-objects@xxxxxxxxxxxxxxx, Raul Berina <raul_berina_fq@...> wrote: > > Hello, > > How can I check the string value using preg_match()? > > The name inputted should have exactly one comma (,). If 0, 2, or more commas are encountered, return FALSE, > > Sample: > > Davis, Nathan Ventura = True > Davis, Nathan, Ventura = False > Davis Nathan Ventura = False > > Your help is appreciated. > > Raul > > > > LearnCareGo missions mobilization for local churches > > > --------------------------------- > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. > > [Non-text portions of this message have been removed] >