W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2006

[whatwg] Web Forms: pattern attribute

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 15 Aug 2006 09:19:17 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0608150915590.5340@dhalsim.dreamhost.com>
On Mon, 3 Apr 2006, Michel Fortin wrote:
>
> Something about the pattern attribute in Web Forms got me thinking:
> 
> > The regular expression language used for this attribute is the same as that
> > defined in [ECMA262], except that the pattern attribute implies a ^ at the
> > start of the pattern and a $ at the end (so the pattern must match the
> > entire value, not just any subset).
> 
> Does that mean that a pattern attribute like "foo|bar" should translate 
> to /^foo|bar$/ ? Wouldn't it make more sense it it was /^(foo|bar)$/ 
> with the parentesis?
> 
> Because in the first case it would match either something that begins by 
> "foo" (like "football") or ending with "bar" (like "babar"). In the 
> second case it would match only "foo" or "bar", nothing else. The later 
> interpretation seems more in line with the intent, but I suppose this 
> could be made clearer.

Good point. Fixed. Thanks.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 15 August 2006 02:19:17 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:28 UTC