Skip to content

Commit

Permalink
Change regex used to detect GNU sed.
Browse files Browse the repository at this point in the history
  • Loading branch information
hdwalters committed Sep 9, 2024
1 parent b344afa commit 4b40372
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/std/text.ab
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fun replace_regex(source: Text, pattern: Text, replacement: Text, extended:
// GNU sed versions 4.0 through 4.2 support extended regex syntax,
// but only via the "-r" option; use that if the version information
// contains "GNU sed".
unsafe $re='\bGNU sed\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]]$
unsafe $re='\bCopyright\b.+\bFree Software Foundation\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]]$
let flag = status == 0 then "-r" else "-E"
return $echo "{source}" | sed {flag} -e "s/{pattern}/{replacement}/g"$
} else {
Expand Down

0 comments on commit 4b40372

Please sign in to comment.