feat(regexp): re-seq, re-replace/-first, re-split#131
Merged
Conversation
Complete the regexp library with the remaining Clojure-style builtins:
- re-seq: vector of every non-overlapping match, each shaped like
re-find (match string, or [whole g1 g2 …] with groups)
- re-replace / re-replace-first: rewrite matches with $1 / ${name}
group references ($$ for a literal $); replace-first leaves the
string unchanged when there is no match
- re-split: split around matches into a vector, with an optional
integer limit (Go Split semantics: trailing empties kept)
Docs (README, CHANGELOG, LANGUAGE.md) and tests updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the regexp library — the three functions left as "planned":
re-seq— vector of every non-overlapping match, each shaped likere-find(the match string, or[whole g1 g2 …]with groups).[]when nothing matches.re-replace/re-replace-first— rewrite matches with$1/${name}group references ($$for a literal$).re-replace-firstleaves the string unchanged when there is no match. Function replacements are not supported.re-split— split around matches into a vector, with an optional integer limit. Follows Go'sSplit: trailing empty pieces are kept.All accept a compiled regex or a raw
¬…¬pattern, like the existing builtins.Docs (
README.md,CHANGELOG.md, regeneratedLANGUAGE.md) and tests updated; both the untagged and-tags debuggersuites pass locally.🤖 Generated with Claude Code