preg_match allowing a-z AND å ä ö ü
From: Daniel (no_at_spam.com)
Date: 11/19/03
- Next message: Pedro Graca: "Re: preg_match allowing a-z AND Q_=E4_=F6_=FC?="
- Previous message: Jon Kraft: "Re: PHP mailer script"
- Next in thread: Pedro Graca: "Re: preg_match allowing a-z AND Q_=E4_=F6_=FC?="
- Reply: Pedro Graca: "Re: preg_match allowing a-z AND Q_=E4_=F6_=FC?="
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Pedro Graca: "Re: preg_match allowing a-z AND Q_=E4_=F6_=FC?="
- Previous message: Jon Kraft: "Re: PHP mailer script"
- Next in thread: Pedro Graca: "Re: preg_match allowing a-z AND Q_=E4_=F6_=FC?="
- Reply: Pedro Graca: "Re: preg_match allowing a-z AND Q_=E4_=F6_=FC?="
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|