W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2004

[whatwg] Re: Various attributes

From: Jim Ley <jim.ley@gmail.com>
Date: Thu, 17 Jun 2004 09:23:17 +0100
Message-ID: <851c8d31040617012375a6ad12@mail.gmail.com>
On Wed, 16 Jun 2004 18:57:38 +0100, Malcolm Rowe
<malcolm-what at farside.org.uk> wrote:
> Jim Ley writes:
> >> > Why require the ^ and $ in the regexp, what's the point in the
> >> > restriction?
> >> They are not required; they are implied. The reason is that otherwise
> >> authors would almost always have to add them, which would be the source
> >> of much confusion.
> > I disagree, there's many times where I've been happy with matching a
> > regexp in validation that didn't include the begin and end, and
> > because they are implied, there's no way to not have them, meaning
> > we'd have to have much more complicated regexps.
> 
> I disagree - pattern="[0-9]{4}" is significantly more common than something
> like pattern=".*foo.*", and seriously, how much extra work was the latter?

Oh, right, can Pattern not work on fields that can contain newlines
then, I misunderstood, I thought it could, that's not so useful then.

In any case  "^[0-9]{4}$" and "foo"  were my suggestions, both are
equally simple as the above.

Jim.
Received on Thursday, 17 June 2004 01:23:17 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:34 UTC