- From: Jonas Sicking <jonas@sicking.cc>
- Date: Wed, 10 Nov 2010 09:48:01 -0800
- To: Maciej Stachowiak <mjs@apple.com>
- Cc: Ian Hickson <ian@hixie.ch>, HTML WG <public-html@w3.org>
On Wed, Nov 10, 2010 at 9:34 AM, Maciej Stachowiak <mjs@apple.com> wrote: > > On Nov 10, 2010, at 9:18 AM, Ian Hickson wrote: > >> On Wed, 10 Nov 2010, Jonas Sicking wrote: >>>> >>>> http://dev.w3.org/html5/status/issue-status.html#ISSUE-137 >>> >>> The editor was never given a chance to respond to the new information >>> that was made available in the bug before this was turned into an issue. >>> >>> So given the fact that it's unlikely that the regexp won't be extended >>> to deal with the use case, Ian, are you still opposed adding some >>> attribute to allow case insensitive matching? >> >>> From a holistic point of view, I think the platform would be best served >> by improving regular expression syntax throughout the platform rather than >> having to update each place that uses regular expressions each time a new >> feature is added. I also think it is too early to know how we should >> improve pattern="" at this point, since it is not widely used. So on >> balance I do not think it is a good idea for us to make the proposed >> change at this point. > > > Just as a technical point about ECMAScript regexps (with chair hat off): > > In ECMAScript, the regular expression syntax is split into two parts, pattern and flags. All ways of creating a regexp from a string allow passing both. The HTML5 pattern="" attribute only allows expressing the pattern, not the lags. So it's not consistent with the regexp system in the rest of the platform. Allowing the flags to be expressed (either with a separate attribute, or by allowing the full regexp literal syntax in the pattern attribute) would make HTML5 consistent with ECMAScript. It is currently not consistent. Allowing the pattern attribute to express the flags part of the regexp syntax would also guarantee all future ES regexp improvements carry over to HTML5, whether they are in the flags part or the pattern part of the syntax. > > Short version: ECMAScript has the capability to express a case-insensitive regexp already, but the pattern="" attribute does not gain that feature because it only allows one part of the two-part ECMAScript regexp syntax. I agree with Ian that an ideal solution would be to allow something like the (?i...) syntax described in the bug. This is better both because it allows all features to be expressed as a single string, and because it allows using both case sensitive and case insensitive matching in the same expression. However given that it doesn't seem like this is about to happen for ECMAScript, I think we'll have to live with the reality of that and add a separate attribute. > In fairness, of the current three ECMAScript regexp flags, only two seem likely to have a useful effect on the pattern attribute, specifically the "m" and "i" flags, but not the "g" flag. Actually, since <input> for all relevant types can't contain newlines (i think), the "m" flag doesn't seem useful here either. / Jonas
Received on Wednesday, 10 November 2010 17:48:56 UTC