Skip to content

Commit 5b16020

Browse files
github-actions[bot]Copilotdbrattliclaude
authored
feat(stdlib): add re (regular expressions) module bindings (#273)
* feat(stdlib): add re (regular expressions) module bindings 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> * refactor(stdlib): drop redundant Emit attrs in Regex bindings Strip [<Emit>] attributes that simply reproduce the default Fable codegen (positional-only IExports overloads with flags, string-key Match accessors, no-arg `end()`). Per BINDINGS_GUIDE.md and the Random.fs convention, [<Emit>] should only appear when it changes generated output (int casts, keyword args, list wraps). Also collapse the duplicate-literal short flag aliases ([<Literal>] let I = 2) into literal aliases of the long names ([<Literal>] let I = IGNORECASE) so the integer values live in one place. Generated Python is byte-identical for the affected sites; all 430 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Dag Brattli <dag@brattli.net> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8c11d74 commit 5b16020

4 files changed

Lines changed: 677 additions & 0 deletions

File tree

src/Fable.Python.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<Compile Include="stdlib/Itertools.fs" />
2929
<Compile Include="stdlib/Datetime.fs" />
3030
<Compile Include="stdlib/Functools.fs" />
31+
<Compile Include="stdlib/Regex.fs" />
3132
<Compile Include="stdlib/Queue.fs" />
3233
<Compile Include="stdlib/String.fs" />
3334
<Compile Include="stdlib/Sys.fs" />

0 commit comments

Comments
 (0)