Canonical regex semantic feature

Numeric escape disambiguation

Resolves a backslash followed by decimal digits among a numeric backreference, numeric code-point escape, literal digit sequence, or syntax error under the active grammar and capture context.

Semantic feature ID
feature.numeric-escape-disambiguation
Feature class
grammar

Meaning and scope

Resolves a backslash followed by decimal digits among a numeric backreference, numeric code-point escape, literal digit sequence, or syntax error under the active grammar and capture context.

Corpus class: grammar. The claim scope is canonical-invariant.

Corpus shorthand

\\<digits>

This is an abstract corpus form for discussing the semantic shape. It is not universal regex syntax.

Names and semantic variants

Aliases
octal-versus-backreference resolution

No separate semantic variants are declared for this feature.

Syntax and API manifestations

Manifestations are source-specific ways this semantic feature becomes visible. They demonstrate provenance and vocabulary; they are not a universal spelling or a compatibility claim.

SourceKindForm
PCRE2 pattern specificationsyntax rule\\1 … \\077 / PCRE2_EXTRA_PYTHON_OCTAL

Prerequisites, modifiers, and interactions

Prerequisites

The corpus records no separate typed feature interaction for this identity.

Operations, captures, and replacement

Relevant operations

  • compileoperation.compileCompile or validate a pattern without requiring a successful match.
  • full matchoperation.full-matchRequire the match to consume the complete governed subject region.
  • searchoperation.searchFind the first applicable match in a governed subject region.
  • testoperation.testReturn whether a pattern has a match.

Capture and result behavior

When resolved as a backreference the construct consumes the referenced capture value without allocating a new capture; when resolved as a code point or literal it has no capture dependency.

Replacement implications

Pattern-side numeric resolution does not select replacement-reference syntax; replacement dialect ambiguity is governed independently.

Text model, diagnostics, and resources

Unicode and text model

When the selected interpretation is a numeric character escape, admissible values and resulting units depend on the code-point, scalar, code-unit, and malformed-text contract.

Errors and diagnostics

A numeric sequence may be rejected as an invalid group reference or invalid code point instead of being reinterpreted; the exact branch and diagnostic phase are manifestation-specific.

Resource and termination behavior

Resolution occurs during pattern parsing and introduces no independent match-time complexity guarantee or resource limit.

Examples and edge-case concepts

These are semantic test concepts, not claims about the syntax or support of a particular implementation.

Positive
Hold the digit spelling fixed while varying preceding capture count, class context, leading zero and grammar mode.
Negative
Separate a rejected missing-group reference from an accepted numeric character escape or literalized digit.
Edge
Probe 0, 1-7, 8-9, multi-digit values, forward groups and values beyond the text domain.

Authoritative source references

The semantic identity and documented behavior are bound to the following exact corpus source records. Normative publishers remain authoritative for their own standards; the Regex Conformance corpus owns the reviewed cross-source semantic model.

  • ECMAScript RegExpEcma International · ECMA-262 2026 · normative standardpattern grammar, Unicode sets, stateful matching, split and replacementecma-regexp
  • PCRE2 pattern specificationPCRE2 · retrieved at cutoff · official implementation documentationfeature-rich pattern semantics and version boundariespcre2-pattern
  • Python rePython Software Foundation · Python 3.14 · official implementation documentationpattern grammar, atomic and possessive constructs, operations and empty-match advancementpython-re

Corpus binding

Semantic ID feature.numeric-escape-disambiguation, feature revision 4, corpus status frozen declared cutoff semantic universe, discovery cutoff 2026-09-08T00:14:25Z.

Snapshot: semantic-corpus/snapshots/regex-semantic-features-2026-09-08.v4.json
Revision: 3285cc9fa8310df0af00fa50724d65531e0695d9
Semantic digest: e2c99c582ad9c8f2875060f9cb9d3ec0da8057f554ac09477f8e07b96da30b05