| Index: lib/abp2blocklist.js |
| =================================================================== |
| --- a/lib/abp2blocklist.js |
| +++ b/lib/abp2blocklist.js |
| @@ -143,18 +143,23 @@ |
| switch (c) |
| { |
| case "*": |
| if (regexp.length > 0 && i < lastIndex && text[i + 1] != "*") |
| regexp.push(".*"); |
| break; |
| case "^": |
| - if (i < lastIndex) |
| - regexp.push("."); |
| + let separator = "[^-_.%" + (justHostname ? "" : "A-Z") + "a-z0-9]"; |
| + if (i == 0) |
| + regexp.push("^https?://(.*" + separator + ")?"); |
| + else if (i == lastIndex) |
| + regexp.push("(" + separator + ".*)?$"); |
| + else |
| + regexp.push(separator); |
| break; |
| case "|": |
| if (i == 0) |
| { |
| regexp.push("^"); |
| break; |
| } |
| if (i == lastIndex) |