forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for "hasIndices" RegExp flag (facebook#968)
Summary: This change adds support for `hasIndices` RegExp flag, according to ES2022 specifications. References: https://262.ecma-international.org/13.0/#sec-regexp-regular-expression-objects https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices This change is also related to this issue: facebook#932 Pull Request resolved: facebook#968 Test Plan: ``` javascript var str = "The Quick Brown Fox Jumps Over The Lazy Brown Dog"; var regex = /quick\s(?<color>brown).+?(?<action>jumps).+?(?<where>over_)*/dgi; var res = regex.exec(str); print(Object.getOwnPropertyNames(res)); // 0,1,2,3,length,index,input,groups,indices print(Object.getOwnPropertyNames(res.indices)); // 0,1,2,3,length,groups print(res.indices[0]); // 4,26 print(res.indices[1]); // 10,15 print(res.indices[2]); // 20,25 print(res.indices[3]); // undefined print(Object.getOwnPropertyNames(res.indices.groups)); // color,action,where print(res.indices.groups.constructor); // undefined print(res.indices.groups.color); // 10,15 print(res.indices.groups.action); // 20,25 print(res.indices.groups.where); // undefined ``` Reviewed By: neildhar Differential Revision: D48396577 Pulled By: fbmal7 fbshipit-source-id: 11f2e52630d3ddbc7e34c3cdbcc80849df458bc5
- Loading branch information
1 parent
3b5784a
commit 2afc7b0
Showing
6 changed files
with
205 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.