Adding DOTALL modifier to ECMAScript regex standards

Jake Reynolds jreynoldsdev at gmail.com
Mon Aug 15 14:45:50 UTC 2016


> Formal proposal (incl. proposed spec changes) for this feature:
https://github.com/mathiasbynens/es-regexp-singleline-flag

Very well written, thank you for writing that up.  I've not been part of
this process before so I'm not sure how it works, but if there is anything
you need/want from me feel free to reach out.

Thanks,
Jake

On Mon, Aug 15, 2016 at 3:35 AM, Mathias Bynens <mathias at qiwi.be> wrote:

>
> > On 10 Aug 2016, at 16:02, Jake Reynolds <jreynoldsdev at gmail.com> wrote:
> >
> > I brought up the topic of adding the DOTALL modifier to the Chrome V8
> Engine here and was directed to es-discuss.  I was curious about the
> practicality and the want for adding a DOTALL modifier to the ECMAScript
> standards in the future?
> >
> > For those that don't know that DOTALL modifier is a regex modifier that
> allows the '.' symbol to match newlines as well.
> >
> > Example regex: /he[.*]?llo/
> > Example search string 1: hello
> > Example search string 2: he
> > llo
> >
> > The above regex will match the 1st search string but will not match the
> 2nd.
> >
> > In ECMAScript the only current way to make a match like that work is to
> use [\d\D] which will match everything including newlines, given below.
> >
> > Current workaround regex: /he[\d\D]?llo/
> >
> > The s modifier is the standard in most major languages except Javascript
> and Ruby.  This will allow newline matching for the . symbol.  The proposed
> regex is below:
> >
> > Proposed new regex: /he[.*]?llo/s
> > Example search string: he
> > llo
>
> Formal proposal (incl. proposed spec changes) for this feature:
> https://github.com/mathiasbynens/es-regexp-singleline-flag
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160815/ee874617/attachment.html>


More information about the es-discuss mailing list