W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > October 2010

[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]

From: <bugzilla@jessica.w3.org>
Date: Tue, 12 Oct 2010 12:56:31 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1P5eP9-0007MP-Gy@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11011

--- Comment #1 from Vegard Larsen <vegard@xaltra.net> 2010-10-12 12:56:31 UTC ---
A small use case: you wan't to validate a password (simply [A-Za-z0-9]{5,}),
but cannot accept any case-variation of the word "password":

    <input 
      type="password" 
      name="foo" 
      pattern="(?![Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd])[A-Za-z0-9]{5,}" 
      required />

This becomes tedious very quickly. If mode specifiers were supported in
Javascript regular expressions, one could try:

    (?i)(?!password)[A-Za-z0-9]{5,}

According to the spec, this should be equivalent to:

    /^(?:(?i)(?!password)[A-Za-z0-9]{5,})$/

This would have worked if Javascript's regular expressions had supported mode
specifiers (it works when parsed as PCRE or a Java or a .NET regex).

-- 
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 12:56:33 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 16:30:59 UTC