Todd Burch <promos / burchwoodusa.com> writes:

> Perhaps a fairly bold statement, coming from a novice regex'er.   :)
>
> I'm creating a form (php) and have conjoured up this regex.
>
> My objective with this regex is to be sure I get a valid person's name.
> With that, I am assuming a real name does not contain 0-9, punctuation
> chars, programming symbols, and so on.
<snip>
> Anyway, feedback is appreciated.  Here it is:
>
> function valid_name($name) {
>   return eregi("^(([a-záàâäãåçéèêëíìîïñóòôöõúùûüß)+( ?)*)+$", $name) ;
> }

I don't know PHP regular expressions, but a bit of googling suggests
that you can use standard POSIX character classes, so I'd replace that
list of letters with [[:alpha:]].  You also have some extraneous
parentheses that could be stripped away, so that leaves you with:

   return eregi("^([[:alpha:]]+(-| +)?)+$", $name) ;

That adds in the hyphenated name thing, but disallows something like:
   Hillary Rodham--Clinton
or
  Hillary Rodham- Clinton
You're allowed either some number of spaces or a single dash between
words, but not multiple dashes or both a dash and a space.

At this point, if it isn't working you may be stuck in locale and/or
character set encoding issues.  Working those out is left as an
exercise for the one of us closer to the PHP install.  A word of
warning: i18n can drive you positively batty if you let it.

-- 
s=%q(  Daniel Martin -- martin / snowplow.org
       puts "s=%q(#{s})",s.to_a.last       )
       puts "s=%q(#{s})",s.to_a.last