Reading
A maintainer must decode punctuation, precedence, and capture structure before understanding domain intent.
Regular expressions are compact, fast, and deeply embedded in software. STRling does not replace that engine; it gives people a clearer way to build patterns for it.
Short RegEx is often ideal. As requirements add choices, optional pieces, captures, and assertions, the same compactness can make review and change harder.
A maintainer must decode punctuation, precedence, and capture structure before understanding domain intent.
Editing a dense string can accidentally alter grouping, escaping, or quantifier scope.
RegEx syntax rarely appears in host-language autocomplete, while named APIs and signatures can.
The TypeScript 4.0.3 Preview adapter records literal strings and reusable Pattern values as Simply operations.
import * as s from '@strling-lang/strling/simply';
const digit = s.between('0', '9');
const prefix = digit.rep(1, 3);
const area = digit.rep(3);
const subscriber = digit.rep(4);
const separator = s.may(s.inChars('-', '.', ' '));
const phone = s.merge(prefix, separator, area, separator, subscriber);This example shows an unanchored phone-like shape and the exact ECMAScript 2024 artifact rendered as a JavaScript RegExp literal. Naming prefix,area, and subscribermakes their roles available to review and reuse.
merge(...) places pieces in order. anyOf(...) in TypeScript and any_of(...) in Python express alternatives.
may(...) makes a piece optional. Static constructors accept repetition bounds, and Pattern values expose repetition methods.
capture(...) creates a numbered group; group(name, ...) gives extracted text a stable domain name.
ahead, notAhead, behind, and notBehind expose lookaround intent.
Python uses names such as any_of and in_chars; TypeScript uses anyOf and inChars. The concepts stay recognizable without pretending every language is identical.
STRling validates API inputs and the public specification defines diagnostics for unsupported features and engine incompatibility. The canonical compiler analyzes requests and lowers them for an exact target profile. The target engine executes the artifact.
Read the portability modelFor a tiny one-off expression, raw RegEx may be the clearest choice. Reach for STRling when a pattern carries business meaning, will evolve, needs review, or should be shared across a codebase.