Unpublished candidate 0.3.1 behavior is documented here. Thesupport record separates local verification frompublished MoonX behavior; moonx examples use registry releases.
The candidate uses core 0.8.2's bounded flat byte DFA and required-literalrejection for eligible boolean searches. A block filter skips complete recordsonly when the required literals are absent and inversion/context are disabled;binary inspection and incomplete tails keep their existing paths. Countingprocesses buffered records synchronously. Assertion-free, reference-free spanprograms can precompute epsilon closures. Eligible -o searches use boundedreverse/forward automata over byte views to select leftmost-longest spans.Multiple patterns share fallback text conversion; each eligible pattern retainsa start bitmap for the current record. Span output advances synchronously untilits 64 KiB flush threshold, then resumes the same record. Single-literal countslocate matching records directly when case/word/whole filters are absent and theliteral cannot cross a record delimiter. Word/whole filters, assertions, references and cacheexhaustion preserve existing matching rules. Cached state is owned by eachcompiled record matcher.
Four or more nonempty fixed patterns can share a compiled literal set insteadof searching every pattern separately. Patterns of at least three bytes usetwo-byte shifts; repeated failed verification can lazily switch to a byte-classAho-Corasick table. Shorter sets start with that table. Each compiled set cachesone construction attempt; budget exhaustion safely retains shifts withoutrebuilding on later records. Every later search still starts with shifts sosparse inputs can skip quickly. Compilationis bounded by 4096 literal bytes and, for the automaton, 1024 states. Empty oroversized sets and word/whole filters keep the existing path. Eligible countslocate a matching record and skip its remaining hits. Long-record regex spansalso reuse proven self-looping suffixes within one immutable record, whileretaining leftmost-longest selection. See ADR-0003for measured gains, rejected experiments and remaining performance gaps.
Search text using basic regular expressions by default, extended expressionswith -E, or fixed strings with -F; -G restores basic syntax. Options include-E, -F, -G, -o, -i, -v, -n, -b, -c, -l, -L, -q,-H, -h, -x, -w, -e, -f, and recursive -r. -A/-B/-C emitcontext with GNU-style selected/context separators, while -z switches inputand output records to NUL. Recursive reads accept repeated --include and--exclude basename patterns using portable * and ? wildcards. -R aliasesthe same traversal as -r; neither follows symbolic links during recursion.
Binary input defaults to GNU 3.12's grep: NAME: binary file matches stderrnotice;--binary-files=text (or -a) searches and emits raw records, and--binary-files=without-match skips binary inputs. -s suppresses file-readdiagnostics without hiding status 2. Matching, offsets, and record boundariesuse a byte-oriented C-locale profile without changing the process environment.Input and output use bounded blocks. Records within a block are views; retainedstorage grows with a cross-block record and requested context, rather than theentire input. -q and -l stop reading when their result is determined.Binary detection applies as chunks arrive, so text already emitted before alater NUL remains visible. Complete records and a partial final record survivea later input error; the error still produces status 2.-o emits nonempty, nonoverlapping matches using leftmost-longest selection;-b -o reports the offset of each match. No group separator is emitted withoutcontext options. BRE/ERE patterns are compiled once by the shared C-bytematcher, including pattern backreferences and directional/ordinary wordassertions. Each -e expression retains its own capture numbering. -i foldsC-byte literals, classes and backreferences while preserving assertion grammar.Repeated nullable captures follow the tested GNU candidate and capture-registerselection, including counted repeats and references. See theworkspace support record.Locale-sensitive collation andmultibyte case folding are not currently implemented. Exit statuses are 0 for a selectedline/file, 1 for no selection, and 2 for an error.
Standalone --version prints exactly grep 0.3.1 followed by onenewline. Standalone --help starts with Usage: grep, lists bothmetadata options, and ends with a newline. Both write to stdout, leave stdinunread, and exit with status 0. Exact-version publication and verificationremain recorded separately in the support record.