···11+From cae2ad70d6202bc97623be8c7c123ee2736a4644 Mon Sep 17 00:00:00 2001
22+From: aleksana <me@aleksana.moe>
33+Date: Sun, 9 Mar 2025 21:19:27 +0800
44+Subject: [PATCH] replace_regex: remove bash word boundary when detecting
55+ gnused
66+77+Bash linked against C libraries other than GLibc may not support GNU
88+extensions of POSIX Extended Regular Regex. For example,
99+1010+> re='\bx'; [[ 'x' =~ $re ]] && echo "1"
1111+1212+does not output the same result on Linux/GLibc and macOS.
1313+---
1414+ src/std/text.ab | 2 +-
1515+ 1 file changed, 1 insertion(+), 1 deletion(-)
1616+1717+diff --git a/src/std/text.ab b/src/std/text.ab
1818+index fe071e33..82449a02 100644
1919+--- a/src/std/text.ab
2020++++ b/src/std/text.ab
2121+@@ -19,7 +19,7 @@ pub fun replace_regex(source: Text, search: Text, replace: Text, extended: Bool
2222+ // GNU sed versions 4.0 through 4.2 support extended regex syntax,
2323+ // but only via the "-r" option; use that if the version information
2424+ // contains "GNU sed".
2525+- $ re='\bCopyright\b.+\bFree Software Foundation\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $
2626++ $ re='Copyright.+Free Software Foundation'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $
2727+ let flag = status == 0 then "-r" else "-E"
2828+ return $ echo "{source}" | sed "{flag}" -e "s/{search}/{replace}/g" $
2929+ } else {