[whatwg] alternatives/grouping in pattern attributes in Web Forms

Ian Hickson ian at hixie.ch
Tue Aug 15 02:55:00 PDT 2006


On Fri, 14 Apr 2006 mqmq87 at web.de wrote:
>
> This text in section 2.6 doesn't seem to consider alternatives and grouping:
> 
> | Thus, using the ^ character anywhere other than at the start of the pattern,
> | or the $ character anywhere other than at the end of the pattern, prevents
> | the pattern from matching anything (unless the characters are escaped or
> | part of a range).
> 
> This is wrong (and what means "range"? should this read "CharacterClass"?).
> In pattern="[0-9]+$|^0[xX][0-9a-fA-F]+" they would be even required to prevent
> matching "123xyz", "abc0x0" or similar values, unless the whole string is
> enclosed in parentheses.
> 
> More intuitive would be an implicit enclosure of the attribute value between
> "^(?:" and ")$" instead of plain ^ and $ to construct the actual regular
> expression.

In response to earlier comments I changed this to not work by "fixing up" 
the regexp but by explicitly requiring the regexp to match the entire 
string. I've gone ahead and just removed the paragraph you quote above as 
it is just confusing and wrong (as you point out).

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list