Skip to main content

.NET

Describes how recheck checks a regular expression of the dotnet dialect.

Engine​

recheck follows the syntax and the semantics of .NET 10's System.Text.RegularExpressions.Regex.

Settings​

The dotnet dialect has no settings.

$ recheck --dialect=dotnet '/^(a|a)*$/'

Flags and Units​

The matching unit is utf16 (see Matching Units).

recheck supports the following RegexOptions, written as the letters of their inline options.

FlagRegexOptionsInlineNotes
iIgnoreCase(?i)In the invariant culture.
mMultiline(?m)
nExplicitCapture(?n)
sSingleline(?s)
xIgnorePatternWhitespace(?x)

Syntax Limitations​

The following constructs are not supported, and they are reported as unsupported.

  • Balancing groups (e.g. (?<close-open>...)).
  • Internal property names (e.g. \p{_xmlI}).

The RegexOptions RightToLeft, ECMAScript and NonBacktracking have no flag letter, so they cannot be given.

Approximations​

  • .NET has optimizations that recheck does not model, so an attack that recheck reports may not work on .NET, and the runtime-attack verification checks whether it does.
  • \G matches only at the start of the input, since recheck models a search from there, not one from a later position (e.g. Match.NextMatch).
  • Case-insensitive matching follows the invariant culture, not the current culture (e.g. (?i)i does not match İ as it does in the Turkish culture).

Runtime-Attack Verification​

  • Command: dotnet run <file>.cs.
  • Matching: Regex.Match.
  • Engine limits: none.
  • Engine errors: OutOfMemoryException, InsufficientExecutionStackException.
  • Environment variable: RECHECK_DOTNET.

dotnet runs the program as a file-based app, which needs a .NET 10 SDK or later.