Open
Description
- Allow an
options
object as the first optional argument forXRegExp.exec
/test
/replace
/match
/forEach
, and allow anoptions
object for eachXRegExp.replaceEach
replacement array.- This will replace or overload/supersede the following optional arguments:
pos
andsticky
ofXRegExp.exec
/test
,scope
ofXRegExp.replace
/match
, and the third value (scope
) of eachXRegExp.replaceEach
replacement array. - Since
XRegExp.replace
's currentscope
argument is infrequently used (it's more common to set scope via flagg
on the provided regex), it might make sense to not overload thescope
argument but instead just replace it. Same forXRegExp.replaceEach
arrays.
- This will replace or overload/supersede the following optional arguments:
New features planned after and enabled by moving to options object APIs:
- To enable common lookbehind tasks (where lookbehind is used at the start of the pattern), add
follows
anddoesNotFollow
(orprecededBy
andnotPrecededBy
) to theoptions
objects ofXRegExp.exec
/test
/match
/forEach
. These would expect regex objects.follows
would be used like positive lookbehind, anddoesNotFollow
like negative lookbehind. - Add support for
pos
andsticky
toXRegExp.match
/forEach
, via theiroptions
objects.- Cleanup: After adding
pos
andsticky
toXRegExp.match
, search forXRegExp.exec(…, …, pos, 'sticky')[0]
and replace withXRegExp.match(…, …, {pos: pos, sticky: true, scope: 'one'})
.
- Cleanup: After adding
- Add support for
pos
,sticky
, andscope
toXRegExp.matchRecursive
, via its existingoptions
object.- Note that
matchRecursive
already supports the handling ofscope
via flagg
, andsticky
via flagy
. These flags should be superseded bypos
andsticky
, the same way thatscope
supersedes flagg
withXRegExp.replace
.
- Note that