Scoop API

scoop:scoop.regex:0.1.0

scoop.regex

API

  • struct MatchGroup

    An independently copied capture and its range. An empty capture is still a participating group.

  • class MatchGroups

    Immutable numbered and named capture slots. None denotes a group that did not participate.

  • struct MatchRange

    A half-open Unicode scalar range in the original input.

  • class MatchResult

    A snapshot of one successful match, usable after subsequent searches or Regex.close.

  • class Regex

    A reusable PCRE2 UTF-8 pattern. Close it deterministically with close/use. Matching calls can share a compiled pattern, but callers must serialize close against every use of that pattern.

  • enum RegexFailureKind

    A PCRE2 execution failure category, distinct from an ordinary unsuccessful match.

  • class RegexMatchException

    An execution or allocation failure, never converted into an ordinary nonmatch.

  • enum RegexOption

    Options applied when compiling a PCRE2 UTF-8 pattern. Inline pattern options remain effective.

  • class RegexReplacementException

    An error in a replacement template; an available offset counts Unicode scalars.

  • class RegexSyntaxException

    A pattern compilation error with a Unicode scalar offset into the original pattern.

  • function replace

    Replaces every match with a callback result. Callbacks run after the native match and borrow have ended; exceptions propagate without returning partial output.

  • function replaceFirst

    Replaces the first match with literal text.

  • function replaceFirstTemplate

    Replaces the first match using PCRE2's default template syntax.

  • function replaceTemplate

    Replaces every match using PCRE2's default template syntax, including $1, ${name}, and $$.

  • function split

    Splits on matches, retaining empty segments and omitting delimiter captures. Zero limit means unlimited; a positive limit leaves the remaining text in the final segment. Negative limits throw.

  • function splitToSequence

    Produces the same segments as split lazily. Each iterator has independent progress.

  • function toRegex

    Compiles this string as a reusable PCRE2 UTF-8 pattern. The caller owns the returned Regex.

  • function toRegexOrNone

    Returns None only for pattern syntax errors; allocation and unrelated failures still propagate.