Partial regexp matching

Mike Samuel mikesamuel at gmail.com
Mon Feb 19 19:43:38 UTC 2018


On Mon, Feb 19, 2018 at 1:15 PM, Isiah Meadows <isiahmeadows at gmail.com>
wrote:

>
> >
> > We can't base a distinction between yes and maybe on whether a
> > zero-width $ assertion is triggered if there are paths to completion
> > that do not pass through that assertion.
> >
> >
> > const re = /^foo($|d).?/
> >
> > // This variant uses the $ assertion
> > console.log(
> >   re.exec("foo")[0] === 'foo')
> > // yes would be inappropriate, but yes|maybe would be because
> >
> > // This variant uses the d
> > console.log(
> >   re.exec("food")[0] === 'food')
> > // and yes|maybe would be appropriate here since
> >
> > console.log(
> >   re.exec("foods")[0] === 'foods')
> >
>
> This particular scenario would not matter to me directly because all I
> need is a "could this match now or potentially later". The optional
> end would be fine, since I'd have the invariant that when I check each
> child, I'll be adding a space along with the next test's name anyways
> (and thus won't have a `d` to worry about).
>
> As for whether it should consider it "ended", I think that's something
> that could probably be spec'd out in a proposal repo, and I doubt
> that'd be a blocker for stage 1 (that's typically a stage 2 concern).


Fwiw, it sounds like a fine idea to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180219/c428f931/attachment.html>


More information about the es-discuss mailing list