Introduce split_inclusive to API
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4k
- Forks
- 534
- PR merge metrics
- No merged PRs in 30d
Description
This issue has been brought up before in #285 and #330 but I think it might be worth revisiting.
I think it might be useful to introduce a full_split method on a Regex. This would behave similar to the current split method, but would also return values that match the regex. The iterator would return an enum for every iteration, either a Delim (match) or a Text (non-match).
This could have a few helpful applications. In #330 the author suggested they were using it in some kind of calculator. Personally, I would use this for tokenizing. In the same issue, there was a suggested fix, but I think it might be helpful to include it into this crate officially.
I've based the names on OCaml's own regex api (seen here)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing Regex::split API and the discussions in #285 and #330. Review the proposed full_split behavior and the Delim and Text variants; done would mean an agreed public API that returns both matches and non-matches for each iteration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100