Skip to content

Commit b86dcd6

Browse files
committed
perf(parse): optimize regex pattern
1 parent e3adef4 commit b86dcd6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type AuthParam = [key: string, value: Token | QuotedString];
9595

9696
/** Generate from _abnf.ts. */
9797
const reAuthParam =
98-
/^(?<key>[\w!#$%&'*+.^`|~-]+?)[\t ]*?=[\t ]*?(?:(?<token>[\w!#$%&'*+.^`|~-]+?)|(?<quotedString>"(?:\t| |!|[ \x23-\x5B\x5D-\x7E]|[\x80-\xFF]|\\(?:\t| |[\x21-\x7E]|[\x80-\xFF]))*?"))$/;
98+
/^(?<key>[\w!#$%&'*+.^`|~-]+?)[\t ]*?=[\t ]*?(?:(?<token>[\w!#$%&'*+.^`|~-]+?)|(?<quotedString>"(?:[\t !\x23-\x5B\x5D-\x7E\x80-\xFF]|\\[\t \x21-\x7E\x80-\xFF])*?"))$/;
9999

100100
/** Parse string into {@link AuthParam}.
101101
* @throws {SyntaxError} It the input is invalid [auth-param](https://www.rfc-editor.org/rfc/rfc9110.html#section-11.2-5).

0 commit comments

Comments
 (0)