Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7743

Re: Simpler way to validate form fields?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: Simpler way to validate form fields?
Date Fri, 07 Dec 2012 11:56:58 +0100
Lines 21
Message-ID <aie0bqFd55fU1@mid.uni-berlin.de> (permalink)
References <2lusb8ldn2g35j7p025r8ep45i5g1gkat2@4ax.com> <ai8k28F62c0U1@mid.uni-berlin.de> <2m8ub8dm7cq38dbtorvlpbs4nq85h1q3gu@4ax.com> <ai8oanF70n6U1@mid.uni-berlin.de> <oagub8t658vanhdeajl0vgkvurn2ji7cve@4ax.com> <qr81c8d7bqr1u7gtum1ikb840ampn9ej2u@4ax.com> <m6h1c8t93qrlcpsc7lpsvqmbd8ook9ldov@4ax.com> <aic0vpFu5u3U1@mid.uni-berlin.de> <tag3c8pk0dj2vusjn1gd7ebmhp1ik4kpk1@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de QW1G6pIsmMAG9Lex+IjDFwGsJ+im2ix7PkC8/bwoU5D8b+9cxLinrCkxJKq9vymZM=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
In-Reply-To <tag3c8pk0dj2vusjn1gd7ebmhp1ik4kpk1@4ax.com>
Xref csiph.com comp.lang.php:7743

Show key headers only | View raw


Am 07.12.2012 11:15, schrieb Gilles:
> On Thu, 06 Dec 2012 17:55:21 +0100, "M. Strobel"
> <sorry_no_mail_here@nowhere.dee> wrote:
>> The date verification problems are a all time favorite in programming.
>>
>> But to the regular expression: they just pick the pattern where they find it, so this
>> is always a tolerant and save input reading. You might as well leave off the ^ and $
>> delimiters.
> 
> It's better to keep ^.../ so that it doesn't allow garbage like
> "qdfqdflqk 11/11/2000 qsdjflqksdfjql".

Your decision. I think error tolerant is more user friendly. And you can be sure,
that a regular expression is the best possible input filter, no need for filter_var()
in this case.

/Str.

P.S. I am waiting for someone to point out that only the best possible regexp is the
best possible input filter.

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-04 23:37 +0100
  Re: Simpler way to validate form fields? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2012-12-04 23:44 +0000
    Re: Simpler way to validate form fields? Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-04 19:04 -0500
  Re: Simpler way to validate form fields? Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-04 19:07 -0500
    Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-05 11:32 +0100
    Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-05 12:49 +0100
  Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-05 10:56 +0100
    Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-05 11:36 +0100
      Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-05 11:52 +0100
      Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-05 12:09 +0100
        Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-06 14:43 +0100
          Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-06 14:55 +0100
            Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-06 17:50 +0100
              Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-06 17:51 +0100
            Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-06 17:50 +0100
              Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-06 17:55 +0100
                Re: Simpler way to validate form fields? Gilles <nospam@nospam.com> - 2012-12-07 11:15 +0100
                Re: Simpler way to validate form fields? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-07 11:56 +0100

csiph-web