Repository navigation
Document EF Core regex translation limitations - #485
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 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.ReplaceandRegex.Counttranslation entries, including the PostgreSQL 15+ requirement forCount. - 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+ |
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.

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
e646416788bab3287e644dc8d2ab4c714d933652↑ 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.ReplaceandRegex.Counttranslations, introduced in EFCore.PG 10.0, including the PostgreSQL 15 requirement forCount.Relates to npgsql/efcore.pg#4156.