W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > November 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: Wed, 10 Nov 2010 15:02:06 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1PGCBa-00068x-1O@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11011

--- Comment #16 from Aryeh Gregor <Simetrical+w3cbug@gmail.com> 2010-11-10 15:02:05 UTC ---
(In reply to comment #15)
> It's near-certain the /i flag won't become part of the JavaScript regexp syntax
> as such (the Pattern production), since it is already provided for in the part
> of the regexp syntax that is not the Pattern production.
> 
> That's regular expression literals, but the RegExp constructor also takes the
> flags as a separate parameter, so there is very little chance of this being
> added as part of the core pattern syntax there too.

I don't see why.  Perl, PCRE, and Python regular expressions all support
regular expressions like /abc (?idef)/ to mean /abc [dD][eE][fF]/, i.e.,
everything inside (?i...) is matched case-insensitively.  This could be used
here, but also anytime you want to match part of a string case-sensitively and
part case-insensitively (although I admit I've never actually had to do that in
my life).

Anyway, I don't see why JavaScript can't support this syntax too.  (Except if
it conflicts with existing syntax somehow?  Does /(?ifoo)/ match "?ifoo" in
JavaScript right now?  I seem to get errors when I try it in Firefox and
Chrome.)

-- 
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 Wednesday, 10 November 2010 15:02:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 10 November 2010 15:02:09 GMT