[Bug 11011] Since Javascript does not support mode specifiers inside the regular expression, there is no simple way of matching a single word case-insensitively besides turning into [Ww][Oo][Rr][Dd]

http://www.w3.org/Bugs/Public/show_bug.cgi?id=11011

--- Comment #6 from Vegard Larsen <vegard@xaltra.net> 2010-10-12 20:37:32 UTC ---
(In reply to comment #4)
> Are there other regexp flags that make sense here? If not then it might be
> better to just add a boolean patternignorecase attribute.

Well, the other flags are global and multiline. global doesn't apply here, as
the pattern has to match the entire string. multiline does not apply either, as
there are no input elements that take multi-line values, and the pattern
attribute isn't specified for textareas.

Your suggested attribute would work for me.

(In reply to comment #5)
> We could just add support for mode specifiers to JS. Or we could say that this
> use case really should be done from script (which is very quickly likely to
> become better if you're doing password strength testing).

That would mean changing the ECMAScript specification, but would be the best
solution because it would bring Javascript regular expressions more in line
with PCRE, .NET and Java regular expressions.

Depending on whether you support mode specifiers for parts of the regular
expression or just globally changing the mode inside the regular expression, it
could also provide much more powerful regular expressions.

As far as I can tell, there really are 4 options here (listed in my order of
preference):

1. Drop the requirement that the regular expression must match the entire
value, and let HTML author write a complete Javascript regex in the pattern
attribute. This is probably the easiest route to take that fixes the problem.
(There are probably reasons behind the "match entire value"-policy that I fail
to see)

2. Add a patternignorecase attribute as suggested above.

3. Try to enforce a change in Javascript's regular expression syntax to support
inline mode specifiers, even for parts of a regular expression (it really
doesn't make sense only to allow setting an inline mode specifier for the whole
regex). This is probably a lot of bureaucratic work, but would also have other
positive side effects.

4. Delegate this functionality to scripting. Won't require a change to existing
implementations. (This is the "ignore the issue, hope I go away"-alternative)

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 12 October 2010 20:37:34 UTC