You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow an options object as the first optional argument for XRegExp.exec/test/replace/match/forEach, and allow an options object for each XRegExp.replaceEach replacement array.
This will replace or overload/supersede the following optional arguments: pos and sticky of XRegExp.exec/test, scope of XRegExp.replace/match, and the third value (scope) of each XRegExp.replaceEach replacement array.
Since XRegExp.replace's current scope argument is infrequently used (it's more common to set scope via flag g on the provided regex), it might make sense to not overload the scope argument but instead just replace it. Same for XRegExp.replaceEach arrays.
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 and doesNotFollow (or precededBy and notPrecededBy) to the options objects of XRegExp.exec/test/match/forEach. These would expect regex objects. follows would be used like positive lookbehind, and doesNotFollow like negative lookbehind.
Add support for pos and sticky to XRegExp.match/forEach, via their options objects.
Cleanup: After adding pos and sticky to XRegExp.match, search for XRegExp.exec(…, …, pos, 'sticky')[0] and replace with XRegExp.match(…, …, {pos: pos, sticky: true, scope: 'one'}).
Add support for pos, sticky, and scope to XRegExp.matchRecursive, via its existing options object.
Note that matchRecursive already supports the handling of scope via flag g, and sticky via flag y. These flags should be superseded by pos and sticky, the same way that scope supersedes flag g with XRegExp.replace.
The text was updated successfully, but these errors were encountered:
options
object as the first optional argument forXRegExp.exec
/test
/replace
/match
/forEach
, and allow anoptions
object for eachXRegExp.replaceEach
replacement array.pos
andsticky
ofXRegExp.exec
/test
,scope
ofXRegExp.replace
/match
, and the third value (scope
) of eachXRegExp.replaceEach
replacement array.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.New features planned after and enabled by moving to options object APIs:
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.pos
andsticky
toXRegExp.match
/forEach
, via theiroptions
objects.pos
andsticky
toXRegExp.match
, search forXRegExp.exec(…, …, pos, 'sticky')[0]
and replace withXRegExp.match(…, …, {pos: pos, sticky: true, scope: 'one'})
.pos
,sticky
, andscope
toXRegExp.matchRecursive
, via its existingoptions
object.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
.The text was updated successfully, but these errors were encountered: