Skip to content

fix(all): accept RegexOptions.NonBacktracking - #5178

Merged
MangelMaxime merged 2 commits into
mainfrom
fix/regex-nonbacktracking
Oct 27, 2026
Merged

MangelMaxime merged 2 commits into
mainfrom
fix/regex-nonbacktracking

Conversation

@MangelMaxime

Copy link
Copy Markdown
Member

RegexOptions.NonBacktracking is now accepted and ignored, like Compiled: it only changes performance, not match results, and V8's linear l flag is still experimental and rejects the i and u flags that .NET allows with it, so mapping to it would throw on every stock runtime.

Supersedes #4104.

@github-actions

Copy link
Copy Markdown
Contributor

Python Type Checking Results (Pyright)

Metric Value
Total errors 33
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_hash_set.py 18 Excluded
temp/tests/Python/test_applicative.py 11 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 2 Excluded

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow validation changes preserve existing engine behavior, add focused regression coverage, and have no identified blocking issues.

No open issues 🎉

What changed in this PR

This PR accepts and ignores RegexOptions.NonBacktracking across Fable targets, avoiding reliance on V8’s experimental linear-regex flag.

Changes:

  • Allow NonBacktracking in JavaScript/TypeScript, Rust, and Dart runtime option validation without changing engine behavior.
  • Add regression tests across five targets covering case-insensitive construction, static matching, and replacement.
File Description
tests/​Rust/​tests/​src/​RegexTests.fs Test NonBacktracking acceptance on Rust.
tests/​Python/​TestRegex.fs Test NonBacktracking acceptance on Python.
tests/​Js/​Main/​RegexTests.fs Test NonBacktracking acceptance on JavaScript.
tests/​Dart/​src/​RegexTests.fs Test NonBacktracking acceptance on Dart.
tests/​Beam/​RegexTests.fs Test NonBacktracking acceptance on BEAM.
src/​fable-library-ts/​RegExp.ts Accept the option and update the validation message.
src/​fable-library-rust/​src/​RegExp.rs Accept the option without changing regex configuration.
src/​fable-library-dart/​RegExp.dart Accept the option and update the validation message.

Review effort: Balanced

@MangelMaxime
MangelMaxime merged commit a61ec8a into main Oct 27, 2026
36 checks passed
@MangelMaxime
MangelMaxime deleted the fix/regex-nonbacktracking branch October 27, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants