Skip to content

Bug setting search.lastIndex in fixed.replace() method when namespacing feature is on. #287

Closed
@pristinesource

Description

@pristinesource

When the namespacing feature is on, inside the fixed.replace() method it it adds a new object to the end of args (https://github.com/slevithan/xregexp/blob/v4.3.0/src/xregexp.js#L1523). Later the search.lastIndex is set using the second to last item in args which is meant to be the "offset" (https://github.com/slevithan/xregexp/blob/v4.3.0/src/xregexp.js#L1541). The "offset" is no longer at args.length - 2 but instead is now at args.length - 3. The way it is now, if namespacing is on, it sets search.lastIndex to the original string with number of arguments appended to the end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions