R
R
Roman2018-11-16 03:21:03
JavaScript
Roman, 2018-11-16 03:21:03

What browsers and js engines support named bracket groups in regular expressions?

the question is about this:

let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u;
let result = re.exec('2015-01-02');
// result.groups.year === '2015';
// result.groups.month === '01';
// result.groups.day === '02';

// result[0] === '2015-01-02';
// result[1] === '2015';
// result[2] === '01';
// result[3] === '02';

This document was found , which says that the implementation is in the 4th stage of consideration for addition to the standard.
I was surprised to find that the node.js version v10.11.0 I installed already supports this functionality. Hence the question arose of where to find information about the support (planned support, experimental support) of this functionality by browsers, indicating the version and / or date. I didn’t manage to google this information on my own, I confess :)
PS:
test on jsfiddle
Checked by myself:
  • Google Chrome Version 68.0.3440.84 (Official build), (64 bit) WORKS
  • Chromium Version 68.0.3440.75, (64 bit) WORKING
  • Firefox Quantum Version 60.1.0esr, (64 bit) DOES NOT WORK
  • Node.JS Version 10.11.0, (64 bit) WORKING
Other browsers and platforms cannot be tested.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-11-16
@lastuniverse

Firefox DevEdition 64.0b9 (64-bit) - not working.
Furefox 63.0.3 (64-bit) - not working.
Safari 10 - not working
Safari 12 - working

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question