Skip to content

Commit 7a61afa

Browse files
committed
fix: clarify regex assertions in status code pattern matching
The pattern now specifies negative look-ahead and look-behind assertions to ensure accurate extraction of HTTP status codes from text.
1 parent ae828e8 commit 7a61afa

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/src/status_code.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,10 @@ extension type const StatusCode._(int _code) implements int {
714714
/// matches anywhere in the input string. This allows for the extraction of
715715
/// status codes from within larger bodies of text.
716716
///
717-
/// The [pattern] uses negative lookarounds (`(?<!\d)` / `(?!\d)`) to ensure
718-
/// that a three-digit sequence is not part of a longer number, covering the
719-
/// full valid HTTP status code range (100-599) without false positives.
717+
/// The [pattern] uses negative look-ahead (`(?!\d)`) and look-behind
718+
/// (`(?<!\d)`) assertions to ensure that a three-digit sequence is not part
719+
/// of a longer number, covering the full valid HTTP status code range
720+
/// (100-599) without false positives.
720721
///
721722
/// Example usage:
722723
/// ```dart

0 commit comments

Comments
 (0)