Add regex match functions. #22
Draft
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.
Add regex matching functions similar to Python's
remoduleOverview
This PR adds core regex matching functionality to the NFA matcher, providing a Python
re-like interface for pattern matching operations.Changes
match(const std::string_view &text)MatchResultwith match status, positions, and capture groups.re.match()- only matches at string start.find_all(const std::string_view &text)MatchResultobjects for each match found.re.findall()- scans left to right.escape(const std::string_view &text).,*,+,?,|,(),[],{},^,$,\,-) literal.re.escape()- useful for matching literal strings that may contain regex syntax.Implementation Details
SAVEstates.^,$), character classes, and dot wildcards.match_internal()function supports both anchored and unanchored matching.#14