You are here: Re: [PHP] preg_match - help please « PHP « IT news, forums, messages
Re: [PHP] preg_match - help please

Posted by "Mark Rees" on 11/14/83 11:22

"Andrι Medeiros" <andre.caum@gmail.com> wrote in message
news:1122479077.3613.7.camel@vaio...
> 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
> >
>
> A reminder... sometimes First and Last name can contain three words.
> There are portuguese names, like "Inκs de Medeiros". Watch out for that
> too.

Or even four - like Rafael van der Vaart for example - so make sure that the
surname box matches spaces as well, and special characters like the κ, as
well as ' as in John O'Kane

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация