···1+From cae2ad70d6202bc97623be8c7c123ee2736a4644 Mon Sep 17 00:00:00 2001
2+From: aleksana <me@aleksana.moe>
3+Date: Sun, 9 Mar 2025 21:19:27 +0800
4+Subject: [PATCH] replace_regex: remove bash word boundary when detecting
5+ gnused
6+7+Bash linked against C libraries other than GLibc may not support GNU
8+extensions of POSIX Extended Regular Regex. For example,
9+10+> re='\bx'; [[ 'x' =~ $re ]] && echo "1"
11+12+does not output the same result on Linux/GLibc and macOS.
13+---
14+ src/std/text.ab | 2 +-
15+ 1 file changed, 1 insertion(+), 1 deletion(-)
16+17+diff --git a/src/std/text.ab b/src/std/text.ab
18+index fe071e33..82449a02 100644
19+--- a/src/std/text.ab
20++++ b/src/std/text.ab
21+@@ -19,7 +19,7 @@ pub fun replace_regex(source: Text, search: Text, replace: Text, extended: Bool
22+ // GNU sed versions 4.0 through 4.2 support extended regex syntax,
23+ // but only via the "-r" option; use that if the version information
24+ // contains "GNU sed".
25+- $ re='\bCopyright\b.+\bFree Software Foundation\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $
26++ $ re='Copyright.+Free Software Foundation'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $
27+ let flag = status == 0 then "-r" else "-E"
28+ return $ echo "{source}" | sed "{flag}" -e "s/{search}/{replace}/g" $
29+ } else {