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
[Bug Report] Replace does nothing when trying to replace ",*" with nothing #2108
Fixes it. Replace with a * or ? pattern now replaces the text the pattern matches; ,* with nothing turns 10.0.0.1, fe80::1 into 10.0.0.1, as in Excel.
Setup: PR head a8de4640 (the PR has since been rebased to 5fb58db1 with the same code change), main at 06920de, Windows 11. gridcraft-cli run with cell.set + edit.replace (the main binary and the PR build), compared with Excel for Microsoft 365 (16.0 build 20430) through COM (Range.Replace, part match).
Cell
Find → Replace
main
PR
Excel
10.0.0.1, fe80::1
,* → nothing
unchanged (replaced: 1)
10.0.0.1
10.0.0.1
hello world
h*o → X
unchanged
X world
X world
hello world
l* → X
unchanged
heX
heX
xaxbyazb
a?b → X
unchanged
xXyX
xXyX
a*b*c
~* → +
unchanged
a+b+c
a+b+c
Hello hello
h?llo → X
unchanged
X X
X X
Hello hello
h?llo → X, Match case
unchanged
Hello X
Hello X
a1, b2; c3
,*; → |
unchanged
a1| c3
a1| c3
ab-cd-ef
-*- → +
unchanged
ab+ef
ab+ef
Other cases on the PR build (not measured in Excel): * → X replaces the whole text, ~? replaces a literal ?, b? on abcabc gives a_a_, a plain x → - still replaces literally (aXbxc → a-b-c). 200 cells of 32,767 × a with a*b: 0.58 s on the PR build, 0.68 s on main, so no slowdown.
No problems found in the change.
Merging: the rebased head 5fb58db1 is based on main at 06920de, so it merges without conflicts. The earlier head conflicted only in tests and contributors/people.toml.
Tests: the three new tests pass; cargo test -p gridcraft-engine 348 passed, 0 failed; cargo clippy -p gridcraft-engine --all-targets -- -D warnings and cargo fmt --all -- --check are clean (on the PR head, not on the merge).
@iluebbe thanks for checking this against Excel through COM — the table covers more cases than the tests do. The rebased head 5fb58db1 carries the same change as a8de4640, so your results hold for it.
Still fixes it. Since the first check, the wildcard Replace folds case as Find does (9515054), and main was merged in (last at 11bb673). Every wildcard Replace case tried gives Excel's result. The two differences left are ~ patterns that main handles the same way and that #1455 covers.
Setup: PR head a6c2872, merged locally with main at 70327cd; main at 70327cd (0.13.0 release binaries); Windows 11. gridcraft-cli run with cell.set, edit.replace and edit.find (one new workbook per Replace case), compared with Excel for Microsoft 365 (16.0 build 20527) through COM: Range.Replace and Range.Find/FindNext on a new workbook, closed without saving.
Earlier finding
Now
The nine cases of the first table match Excel: ,* with nothing on 10.0.0.1, fe80::1 gives 10.0.0.1; h*o, l*, a?b, ~*, h?llo with and without Match case, ,*;, -*-
Still so, measured again on the merge
No problems found in the change
Still none
New cases (part of the cell unless noted). On main every matching pattern with * or ? leaves the cell unchanged, though it counts the cell as replaced. The Match entire cell rows already worked on main:
Find (edit.find, unchanged by the PR) over ten cells, with h*o, h?llo (with and without Match case), ~*, ~?, a?b (entire cell), b*c (formulas and values), 3 (formulas and values), 2?4, h* and * (entire cell): the same cells as Excel, on main and on the PR. ~~ finds nothing, while Excel finds a~b.
Problems: none in the change. The last two Replace rows and the ~~ Find differ from Excel as they do on main. A pattern without * or ? is still taken literally, and a trailing ~ escapes the * that matches appends (find.rs#L6-L14). Excel reads ~~ as one ~ and drops a trailing ~. Both rules are listed in #1455, and the PR description leaves them there.
Merging: merges without conflicts with main at 70327cd.
Activity
ipswe commentedon Oct 21, 2026
Version 0.9.0 on Windows 11
Find and Replace: replace the text a wildcard pattern matches (storyt…
iluebbe commentedon Oct 22, 2026
#2127 checked
Fixes it. Replace with a
*or?pattern now replaces the text the pattern matches;,*with nothing turns10.0.0.1, fe80::1into10.0.0.1, as in Excel.Setup: PR head
a8de4640(the PR has since been rebased to5fb58db1with the same code change),mainat 06920de, Windows 11.gridcraft-cli runwithcell.set+edit.replace(the main binary and the PR build), compared with Excel for Microsoft 365 (16.0 build 20430) through COM (Range.Replace, part match).10.0.0.1, fe80::1,*→ nothingreplaced: 1)10.0.0.110.0.0.1hello worldh*o→XX worldX worldhello worldl*→XheXheXxaxbyazba?b→XxXyXxXyXa*b*c~*→+a+b+ca+b+cHello helloh?llo→XX XX XHello helloh?llo→X, Match caseHello XHello Xa1, b2; c3,*;→|a1| c3a1| c3ab-cd-ef-*-→+ab+efab+efOther cases on the PR build (not measured in Excel):
*→Xreplaces the whole text,~?replaces a literal?,b?onabcabcgivesa_a_, a plainx→-still replaces literally (aXbxc→a-b-c). 200 cells of 32,767 ×awitha*b: 0.58 s on the PR build, 0.68 s onmain, so no slowdown.No problems found in the change.
Merging: the rebased head
5fb58db1is based onmainat 06920de, so it merges without conflicts. The earlier head conflicted only in tests andcontributors/people.toml.Tests: the three new tests pass;
cargo test -p gridcraft-engine348 passed, 0 failed;cargo clippy -p gridcraft-engine --all-targets -- -D warningsandcargo fmt --all -- --checkare clean (on the PR head, not on the merge).luigiPinna commentedon Oct 22, 2026
@iluebbe thanks for checking this against Excel through COM — the table covers more cases than the tests do. The rebased head
5fb58db1carries the same change asa8de4640, so your results hold for it.iluebbe commentedon Oct 28, 2026
#2127 checked again
Still fixes it. Since the first check, the wildcard Replace folds case as Find does (9515054), and
mainwas merged in (last at 11bb673). Every wildcard Replace case tried gives Excel's result. The two differences left are~patterns thatmainhandles the same way and that #1455 covers.Setup: PR head a6c2872, merged locally with
mainat 70327cd;mainat 70327cd (0.13.0 release binaries); Windows 11.gridcraft-cli runwithcell.set,edit.replaceandedit.find(one new workbook per Replace case), compared with Excel for Microsoft 365 (16.0 build 20527) through COM:Range.ReplaceandRange.Find/FindNexton a new workbook, closed without saving.,*with nothing on10.0.0.1, fe80::1gives10.0.0.1;h*o,l*,a?b,~*,h?llowith and without Match case,,*;,-*-New cases (part of the cell unless noted). On
mainevery matching pattern with*or?leaves the cell unchanged, though it counts the cell as replaced. The Match entire cell rows already worked onmain:HELLO worldh*o→XX worldX worldHELLO worldh*o→X, Match casea?b?c~?→+a+b+ca+b+ca~b*c~~?→XaX*caX*ca~ba~~*→XXXbanana*a→XXXXXXXa,b,c*,→XXXcXXca1b2a3b4a*b*→XXXhello world*→XXXabc?→XXXXXXXaXYba**b→XXXhello worldh*d/h*o/?ELLO*→X, Match entire cellX/ unchanged /XX/ unchanged /Xhello world?ELLO*→X, Match entire cell and Match case12345(number)2?4→X/2*4→01X5/ number1051X5/ number105="ab"&"cd"b*c→X="aXd"(showsaXd)="aXd"="xyz"x?z→Q="Q"="Q"ΚΑΛΟΣλ?ς→X(9515054)ΚΑXΚΑXa~b~c~~→+maina+b+cab~cb*~→XmainaXFind (
edit.find, unchanged by the PR) over ten cells, withh*o,h?llo(with and without Match case),~*,~?,a?b(entire cell),b*c(formulas and values),3(formulas and values),2?4,h*and*(entire cell): the same cells as Excel, onmainand on the PR.~~finds nothing, while Excel findsa~b.Problems: none in the change. The last two Replace rows and the
~~Find differ from Excel as they do onmain. A pattern without*or?is still taken literally, and a trailing~escapes the*thatmatchesappends (find.rs#L6-L14). Excel reads~~as one~and drops a trailing~. Both rules are listed in #1455, and the PR description leaves them there.Merging: merges without conflicts with
mainat 70327cd.Tests: on the merge with
mainat 70327cd:replace_with_wildcards_folds_case_as_find_doesfrom 9515054.cargo test -p gridcraft-engine: 504 lib and 83 integration tests pass.io::tests::save_fails_upfront_when_the_temp_name_is_takenwas gated locally, because it doesn't compile on Windows (Windows: the engine's tests compile and the CLI passes clippy again #2426).cargo clippy -p gridcraft-engine --all-targets -- -D warningsis clean under the stricter workspace lintsmaingained in Enforce Rust coding standards via Clippy #2711.cargo fmt --all -- --checkis clean.