RE: [PHP] Regular Expression
| From: | Daren Cotter | Date: | Tue, 01 Oct 2002 02:54:51 +0000 |
| Subject: | RE: [PHP] Regular Expression | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118296@lists.php.net to get a copy of this message | ||
John,
What about foreign names...such as the umlaut in
German? I'm not interested in allowing ALL of the
characters, just the most common ones...I'd hate to
restrict a genuine registration because the name
contains an unaccepted character. Know what I mean?
--- "John W. Holmes" <holmes072000@charter.net> wrote:
> > I need a regular expression to verify various
> inputs
> > on my form. I know the base case of:
> >
> > "^[a-zA-Z0-9]+$"
> >
> > matches any letter or number. I'm looking for
> various
> > input from the list as to what characters should
> be
> > allowed in the following fields:
> >
> > Name: I would think -, ', and space for sure.
> Anything
> > else I don't know. I don't know how to write the
> > expression for this though. I tried escaping the -
> > like \-, but that doesn't work.
>
> Allow a period, too, for names like "St. Laurent"
> "^[-a-zA-Z0-9' .]+$"
>
> > Street Address: Same as above, with #
>
> Again, periods for "Ave."
> "^[-a-zA-Z0-9#' .]+$"
>
> > City: Just ' ??
>
> I'd allow space and period, too, for "Ft. Gordon"
> for example.
>
> "^[-a-zA-Z0-9' .]+$"
>
> > As I said, I'm looking for input, and how to
> actually
> > write these expressions.
>
> Hope that helps.
>
> ---John Holmes...
>
>
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com