Default non-capturing regex flag [WAS: how to create strawman proposals?]

Mike Samuel mikesamuel at
Mon Jun 6 10:14:49 PDT 2011

2011/6/6 Brendan Eich <brendan at>:
> Escapes are a pain, due to the double-backslash burden.

Yep.  To fit into this kind of library, you could use a quasi syntax like


Not as pithy as flags, but extensible via

   regexp.prototype.nonCapturingByDefault = function (parseTree) { ...
return parseTree; };

and you can make the build() bit optional in a lot of cases by
overriding toString, since
String.prototype.replace and friends do implicit value -> string ->
RegExp unless value is a RegExp.

> We really want quasis for this kind of extensibility. Quasis solve the multiline problem too (I hope... :-).

Off-topic, quasis do solve the multiline problem as written.

More information about the es-discuss mailing list