From 43aa7b5876408b1f12dcf5343423b7ed51bce945 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Sun, 2 Feb 2025 12:42:38 -0500 Subject: [PATCH] Updated documentation --- regex/doc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/regex/doc.go b/regex/doc.go index 398ec07..1b821c1 100644 --- a/regex/doc.go +++ b/regex/doc.go @@ -114,7 +114,11 @@ Another, more subtle example is the following regex: x|xx While the stdlib implementation (and most other engines) will prefer matching the first item of the alternation, -this engine will _always_ go for the longest possible match, regardless of the order of the alternation. +this engine will go for the longest possible match, regardless of the order of the alternation. Although this +strays from the convention, it results in a nice rule-of-thumb - the engine is ALWAYS greedy. + +The stdlib implementation has a function [regexp.Regexp.Longest] which makes future searches prefer the longest match. +That is the default (and unchangable) behavior in this engine. 2. Byte-slices and runes: