preg_match allowing a-z AND å ä ö ü

From: Daniel (no_at_spam.com)
Date: 11/19/03


Date: Wed, 19 Nov 2003 11:44:08 GMT

I've been searching the net and Google news groups for a preg_match
expression that will return true on strings containing (uppercase and
lowercase) characters of A-Z, 0-9 and for instance Swedish characters Å Ä Ö.
It should return false on strings containing stuff like -#¤%\"[]()=?&/.

The thing is, I don't want to specifically allow Å Ä Ö, I want a more
general rule in case other characters like ü or ø turn up. Is this possible
to do?

I've tried
preg_match("/^\w+$/", $string)
and
preg_match("/^[[:alpha:]]+$/", $string)

but both returns false on everything except a-z A-Z.

I'm going to use it to test a receiver's name ($to_name) before putting it
in an e-mail header like "$to_name <$to_email>"; The names are entered in a
text field by my users and I want to test the name so it won't mess up the
e-mail header causing the e-mail to fail.

Any help would be greatly appreciated. Thank you.

Daniel



Relevant Pages

  • Re: 128 bit password
    ... If a password is for example 128bit, how long is it in characters (a-z ... If the password is "THISisMYpassword". ... It's the level of coding the security ...
    (microsoft.public.security)
  • Re: small simple regexp favor
    ... anything other than A-Z 1-0 and also allow these 5 special characters?? ... Dim oRE: ... Dim nIdx, sMsg, sRes ...
    (microsoft.public.scripting.vbscript)
  • Re: small simple regexp favor
    ... anything other than A-Z 1-0 and also allow these 5 special characters?? ... Dim oRE: ... Dim nIdx, sMsg, sRes ...
    (microsoft.public.scripting.vbscript)
  • Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
    ... DraguVaso wrote: ... Even using just 17 characters ... With 53 symbols (a-z, A-Z, space) you get ... of repeated string concatenation would be a good start. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
    ... DraguVaso wrote: ... Even using just 17 characters ... With 53 symbols (a-z, A-Z, space) you get ... of repeated string concatenation would be a good start. ...
    (microsoft.public.dotnet.general)