Commit d3521e6
authored
fix(builtins): unescape \/ in sed replacement strings (#1028)
## Summary
- Fix `sed` builtin to properly unescape `\/` in replacement strings,
producing literal `/`
- Also handles `\\` → `\`, `\n` → newline, `\t` → tab in correct order
using placeholder approach
- Adds spec tests for slash unescaping, back-reference groups with
slashes, and escaped backslash
## Test plan
- [x] `sed_unescape_slash_in_replacement` — `\/` produces `/`
- [x] `sed_regex_groups_with_slash` — back-references with `\/` in date
reformatting
- [x] `sed_escaped_backslash_in_replacement` — `\\` produces `\`
- [x] All existing sed spec tests still pass
- [x] Smoke tested via CLI: `echo "abc" | sed 's/b/\//'` → `a/c`
Closes #9591 parent 4e2922e commit d3521e6
3 files changed
Lines changed: 29 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | | - | |
519 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
520 | 525 | | |
521 | 526 | | |
522 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | | - | |
| 582 | + | |
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
| |||
0 commit comments