Skip to content

Commit cd466c5

Browse files
authored
Unnecessary escape characters in cookie.js
Removed unnecessary escape characters from regex in "getCookie function in cookie.js" - . ( ) [ / + The above characters don't need escaping.
1 parent 9680c67 commit cd466c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

6-data-storage/01-cookie/cookie.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function getCookie(name) {
22
let matches = document.cookie.match(new RegExp(
3-
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
3+
"(?:^|; )" + name.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1') + "=([^;]*)"
44
));
55
return matches ? decodeURIComponent(matches[1]) : undefined;
66
}

0 commit comments

Comments
 (0)