Re: preg_match - help please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2005-07-27 at 15:27 +0100, Steve Turnbull wrote:
> Hi
> 
> I want to see that a user is submiting a form field in the correct manner.
> So I decided to use preg_match to verify their input.
> 
> The pattern I am trying to match is;
> 
> Firstname Secondname
> 
> I am not bothered about character length just yet (but advise on this would
> be appreciated if it can be done with a regular expression - saves extra
> checking code), but I would like case sensitity.
> 
> The code I haev so far, which doesn't seem to work is;
> 
> $un = $_REQUEST['name'];
> $exp = '/^\b[a-zA-Z] [a-zA-Z]$/';
> 
> if (preg_match($exp, $un)) {
>     //has this matched?
>     echo "<h2>matched</h2>";
> }
> 
> Help would be greatly appreciated
> 
> Thanks
> Steve
> 

http://pt.php.net/strpos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux