regexlit

package
v0.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package regexlit defines clover's /regex/ literal syntax: a value bracketed by slashes is a regular expression, anything else is not. It is the single source of truth shared by the directive grammar (which parses and renders such values) and the pattern engine (which compiles them), so the two can never disagree on what counts as a regex.

Index

Constants

View Source
const Delim = '/'

Delim opens and closes a regex literal. Slashes are used for sed/perl familiarity, chosen over a re: prefix.

Variables

This section is empty.

Functions

func Body

func Body(s string) (string, bool)

Body returns the pattern between a literal's delimiters, leaving any internal escapes intact for the regex engine. ok is false when s is not a complete regex literal.

func Is

func Is(s string) bool

Is reports whether s is a complete regex literal - opened and closed by an unescaped Delim with no unescaped Delim between. A backslash escapes the next character, so /a\/b/ is one literal but /a/b/ is not (and a lone / is a plain slash, not an empty regex).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL