Skip to content

Commit 808073a

Browse files
committed
Update regex for collapsing multiple forward slashes to preserve URLs and improve clarity in documentation.
1 parent da0a8ee commit 808073a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Confix.Tool/test/Confix.Tool.Tests/TestHelpers/SnapshotBuilder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ public void MatchSnapshot()
7373
private static partial Regex JsonEscapeNotInPathRegex();
7474

7575
/// <summary>
76-
/// Matches two or more consecutive forward slashes that are NOT preceded by a colon (to preserve URLs like https://).
76+
/// Matches two or more consecutive forward slashes that should be collapsed to one.
77+
/// Preserves :// in URLs (https://, http://, file://) but collapses X:// for Windows drive letters.
7778
/// </summary>
78-
[GeneratedRegex(@"(?<!:)/{2,}")]
79+
[GeneratedRegex(@"(?<![a-zA-Z]{2,}:)/{2,}")]
7980
private static partial Regex MultipleSlashesRegex();
8081

8182
public SnapshotBuilder RemoveLineThatStartsWith(string value)

0 commit comments

Comments
 (0)