You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
with -p: a regex literal's .replace replaces only the first match per line — sed s/a/b/g parity is broken #1607
CLAUDE.md promises sed 's/old/new/g' → ... | with -p 'line = line.replace("old", "new")' and sed -E 's/(a)(b)/\2\1/' → /(a)(b)/.replace(line, "$2$1"). The regex form replaces the first match only:
$ echo "it it it" | with -p 'line = /\bit\b/.replace(line, "x")'
x it it
Expected x x x — a per-line transform is the g case by default (there is no non-g sed idiom worth a spelling). Found by the stage 9 agent migrating fixtures (it had to loop). docs/improve_oneliners.md parity matrix should mark the row until fixed. Compiler: installed with v0.15.2.1 (main d783366).
Working as specified. docs/completed/regex-spec.md defines the g flag as "Global — find all matches (affects =~ and replace)", and lib/std/regex.w implements it: echo 'it it it' | with -p 'line = /\bit\b/g.replace(line, "x")' prints x x x; without g the first match only, as in sed. The one-liner table now shows the /g spelling (commit on the ruled-fixes stack layer).
Activity
ehartford commentedon Sep 26, 2026
Working as specified. docs/completed/regex-spec.md defines the
gflag as "Global — find all matches (affects=~andreplace)", and lib/std/regex.w implements it:echo 'it it it' | with -p 'line = /\bit\b/g.replace(line, "x")'printsx x x; withoutgthe first match only, as in sed. The one-liner table now shows the/gspelling (commit on the ruled-fixes stack layer).docs: the one-liner table shows sed's global regex substitution as `/…
docs: the one-liner table shows sed's global regex substitution as `/…
docs: the one-liner table shows sed's global regex substitution as `/…
docs: the one-liner table shows sed's global regex substitution as `/…
docs: the one-liner table shows sed's global regex substitution as `/…
Spec-ruled fixes: Some(place) borrows for Option[&T], module globals …