Proposal: Expose offsets for capturing groups in regular expression matches

Jordan Harband ljharb at gmail.com
Fri Mar 24 00:47:37 UTC 2017


Adding a property to the match result is indeed tricky.


Not sure if you're already aware that named capture groups are stage 3:
https://github.com/tc39/proposal-regexp-named-groups

On Thu, Mar 23, 2017 at 8:08 AM, T.J. Crowder <
tj.crowder at farsightsoftware.com> wrote:

> Excellent idea, and nice and simple as well. I wouldn't think adding a
> property to the match result would rattle cages, it'll be interesting to
> find out.
>
> @eric - I prefer the proposal's approach to offsets. If you need to know
> where the end is, you can always add the length of the captured text, so
> the information is already there.
>
> -- T.J. Crowder
>
> On Thu, Mar 23, 2017 at 3:00 PM, Erik Corry <erik.corry at gmail.com> wrote:
>
>> This would be great.  Can I suggest that both the start and end of each
>> match should be there.  So instead of offsets you would have "starts" and
>> "ends".  Alternatively, offsets should be twice as long with start-end
>> pairs in it.
>>
>> On Mon, Oct 31, 2016 at 9:53 AM, Sebastian Zartner <
>> sebastianzartner at gmail.com> wrote:
>>
>>> Hello together,
>>>
>>> for advanced processing of capturing groups in regular expression, I'd
>>> like to propose to expose their offsets within the results of executing an
>>> expression on a string.
>>>
>>> The complete proposal can be found at https://github.com/SebastianZ/
>>> es-proposal-regexp-capturing-group-offsets.
>>>
>>> I'd like it to be added to the Stage 0 proposals
>>> <https://github.com/tc39/proposals/blob/master/stage-0-proposals.md>
>>> and I'm asking for feedback and a champion to help me bring it into shape
>>> and get it into the standard.
>>>
>>> Thank you in advance,
>>>
>>> Sebastian
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170323/135b6205/attachment.html>


More information about the es-discuss mailing list