Search target slice interface unification #3

Open
opened 2026-05-24 14:05:39 +00:00 by mikael-lovqvist · 1 comment

When searching through strings or sequences alike we want to be able to specify the search slice. Currently some of our interfaces only specified start position.

From what I can gather here we don't get much help with lastIndex with the RegExp() object. This means that we would have to pre-slice in order to support this for regexp, and if we do that, we will also have to either post match correct or have a match object that includes this and have helper properties to compute the absolute positions of the target string.

TODO

  • Gather sites that need to be uplifted to the new protocol
  • Test function
  • Document
When searching through strings or sequences alike we want to be able to specify the search slice. Currently some of our interfaces only specified start position. From what I can gather [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) we don't get much help with `lastIndex` with the [`RegExp()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) object. This means that we would have to pre-slice in order to support this for regexp, and if we do that, we will also have to either post match correct or have a match object that includes this and have helper properties to compute the absolute positions of the target string. **TODO** - [x] Gather sites that need to be uplifted to the new protocol - [ ] Test function - [ ] Document
Author
Owner

The only site relating to RegExp that mentions start_index is

https://gitea.efforting.tech/efforting.tech/nodejs.esm-library/src/branch/main/source/parsing/generic-parsing.mjs

Then it is mentioned by

https://gitea.efforting.tech/efforting.tech/nodejs.esm-library/src/branch/main/experiments/reduction-scanner-1.mjs

Experiments are a bit in flux though and should probably be cleaned up and promoted to examples or just removed if no longer applicable.

The only site relating to RegExp that mentions start_index is https://gitea.efforting.tech/efforting.tech/nodejs.esm-library/src/branch/main/source/parsing/generic-parsing.mjs Then it is mentioned by https://gitea.efforting.tech/efforting.tech/nodejs.esm-library/src/branch/main/experiments/reduction-scanner-1.mjs Experiments are a bit in flux though and should probably be cleaned up and promoted to examples or just removed if no longer applicable.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: efforting.tech/nodejs.esm-library#3