Skip to content

Document EF Core regex translation limitations - #485

Merged
roji merged 1 commit into
mainfrom
roji-regex-translation-footnote
Nov 25, 2026
Merged

roji merged 1 commit into
mainfrom
roji-regex-translation-footnote

Conversation

@roji

@roji roji commented Nov 25, 2026

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: e646416788bab3287e644dc8d2ab4c714d933652

Dimension Assessment Rationale
Change confidence 9/10 ↑ Limitations and supported overloads checked against provider source.
↑ Markdownlint passed; DocFX 2.81.0 verified all six links reach the shared footnote.
↓ Full-site build not run; isolated rendering warned about existing links and API xrefs outside its scope.

Server-translated regular expressions use PostgreSQL's dialect and can differ from .NET, notably when negated character classes encounter LF newlines.

Adds a shared footnote documenting these semantics, constant-options requirements, and unsupported options and overloads. Also lists the previously undocumented Regex.Replace and Regex.Count translations, introduced in EFCore.PG 10.0, including the PostgreSQL 15 requirement for Count.

Relates to npgsql/efcore.pg#4156.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 23:48
@roji
roji enabled auto-merge (squash) November 25, 2026 23:49
@roji
roji merged commit 570c725 into main Nov 25, 2026
3 checks passed
@roji
roji deleted the roji-regex-translation-footnote branch November 25, 2026 23:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The four translations need EFCore.PG 10.0 introduction markers so users of versions 8 or 9 do not mistakenly expect support based solely on the PostgreSQL version requirement.

1 open issue
What changed in this PR

Clarifies how the Npgsql EF Core provider translates .NET regular expressions to PostgreSQL and where their behavior differs.

Changes:

  • Adds Regex.Replace and Regex.Count translation entries, including the PostgreSQL 15+ requirement for Count.
  • Adds a shared note covering newline behavior, constant options, unsupported options and overloads, and when client-side evaluation is needed.
File Description
conceptual/​EFCore.PG/​mapping/​translations.md Expands regex translation coverage and documents compatibility limitations.

Review effort: Balanced

Comment on lines +46 to +49
Regex.Replace(stringValue, pattern, replacement) | [regexp_replace(stringValue, pattern, replacement, 'pg')](https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP) | <sup>[1](#regex-note)</sup>
Regex.Replace(stringValue, pattern, replacement, regexOptions) | [regexp_replace(stringValue, pattern, replacement, flags)](https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP) | <sup>[1](#regex-note)</sup>
Regex.Count(stringValue, pattern) | [regexp_count(stringValue, pattern, 1, 'p')](https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP) | <sup>[1](#regex-note)</sup> Requires PostgreSQL 15+
Regex.Count(stringValue, pattern, regexOptions) | [regexp_count(stringValue, pattern, 1, flags)](https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP) | <sup>[1](#regex-note)</sup> Requires PostgreSQL 15+
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