[Repo Assist] feat(stdlib): add re (regular expressions) module bindings#273
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[Repo Assist] feat(stdlib): add re (regular expressions) module bindings#273github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Adds F# bindings for Python's re module, covering: - Match object: group(), groups(), groupdict(), start(), end(), span(), expand(), string, pos, endpos, lastindex, lastgroup - Pattern object: match(), search(), fullmatch(), findall(), finditer(), sub(), subn(), split(), pattern, flags, groups, groupindex - Module-level functions: compile, match, search, fullmatch, findall, finditer, sub, subn, split, escape, purge - Flags module: IGNORECASE/I, MULTILINE/M, DOTALL/S, ASCII/A, LOCALE/L, UNICODE/U, VERBOSE/X, NOFLAG Also adds 42 tests in test/TestRegex.fs covering all key APIs. Note: CHANGELOG.md is intentionally not updated per repository policy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
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.
🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.
Summary
Adds F# bindings for Python's [
re]((docs.python.org/redacted) (regular expressions) module — one of the most widely used stdlib modules, and a gap identified in the repo's future work notes.Matchgroup(),groups(),groupdict(),start(),end(),span(),expand(),string,pos,endpos,lastindex,lastgroupPatternmatch(),search(),fullmatch(),findall(),finditer(),sub(),subn(),split(),pattern,flags,groups,groupindexcompile,match,search,fullmatch,findall,finditer,sub,subn,split,escape,purgeFlagsmoduleIGNORECASE/I,MULTILINE/M,DOTALL/S,ASCII/A,LOCALE/L,UNICODE/U,VERBOSE/X,NOFLAGUsage example
Files changed
src/stdlib/Regex.fs— new bindings (moduleFable.Python.Regex)test/TestRegex.fs— 42 tests covering all major APIssrc/Fable.Python.fsproj— include new source filetest/Fable.Python.Test.fsproj— include new test fileDesign notes
Fable.Python.Regex(notRe) to avoid collision with F#'s ownRegexfromSystem.Text.RegularExpressions, and the binding value isreto mirror Python'simport re.MatchandPatternare bound as[<Import(..., "re")>]classes withnativeOnlymembers — the same pattern asQueue,datetime, etc. Users never construct them directly.endis a reserved word in F# so is escaped asendin both the binding and tests.matchis a reserved word in F# so is escaped asmatchwhere it appears as a method name onPatternand as a module function. TheIExportsabstractmatchmethod uses backticks correctly.Flagssub-module uses[<Literal>]integer constants so they can be used in|||combinations.CHANGELOG.mdis intentionally not updated per repository policy.CI will validate the build and Python tests.
Note
🔒 Integrity filter blocked 10 items
The following items were blocked because they don't meet the GitHub integrity level.
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: