|
Posted by Curtis on 01/30/07 01:55
On Jan 28, 3:34 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
> Curtis <dye...@gmail.com> wrote:
> > On Jan 27, 5:56 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> >> Geoff Berrow <blthe...@ckdog.co.uk> wrote:
> >> > Message-ID: <op.tmtehzlvqnv...@misant.kabel.utwente.nl> from Rik
> >> > contained the following:
>
> >> >> The way I usually handle it:
> >> >> - I'll have a very retrictive character set for the username (usually
> >> >> something like [a-zA-Z0-9_\s]+).
>
> >> > That's the thing I was looking for. And how would I use that with
> >> > preg_match? Just can't get my head round regex syntax, sorry.
>
> >> Hmmz, correction, I seem to use [a-zA-Z0-9_-]
>
> > This is also fairly restrictive, but allows spaces (as opposed to
> > allowing tabs or newlines): [\w -]
> > Note: \w is the same as [a-zA-Z0-9_]
>
> I'd allow underscores also, so [\w _-].
>
> I usually don't use the \w so I can recognize valid characters somewhat
> easier, but it works OK offcourse.
> --
> Rik Wasmus
Actually \w includes underscores in the character set.
I was not aware that it was dependent upon the current locale, thanks
for the heads up, Micha.
--
Curtis
[Back to original message]
|