$ d8 --harmony-regexp-lookbehind -e
'"123".match(/(?<=(.){3})/);print(RegExp.$1)'
1
$ perl -e '"123" =~ /(?<=(.){3})/;print $1'
3
Currently, V8's implementation is storing the leftmost substring in $1(and \1)
which surprised me a bit.
Also note that in .Net, you can get all captured substrings by that capturing
group using the `.Captures` property
https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.group.captures(v=vs.110).aspx
, in this case it would be [3, 2, 1] (the order is from right to left) .
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss