Skip to content

Commit 21434ae

Browse files
committed
Add test cases for only-match-at-start with lookaheads
1 parent 3656fd8 commit 21434ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Tests/RegexTests/CompileTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,5 +589,9 @@ extension RegexTests {
589589
try expectCanOnlyMatchAtStart("(foo)?^bar", true) // The initial group must match ""
590590
try expectCanOnlyMatchAtStart("(?:foo)?^bar", true)
591591
try expectCanOnlyMatchAtStart("(foo)+^bar", false) // This can't actually match anywhere
592+
593+
// Test lookahead assertions with anchor
594+
try expectCanOnlyMatchAtStart("(?=^)foo", true)
595+
try expectCanOnlyMatchAtStart("(?!^)foo", false)
592596
}
593597
}

0 commit comments

Comments
 (0)