TAILIEUCHUNG - Hacking Firefox - part 14

Starter Regex mẫu biểu quy ví dụ trước trong chương này lưu ý rằng các phần tử lọc mà có thể rất hiệu quả là những lời quảng cáo và quảng cáo. Với biểu thức chính quy, có thể để thể hiện điều này như là một mô hình duy nhất thay vì hai | 132 Part II Hacking Performance Security and Banner Ads Starter Regex Samples Expression Rules Previous examples in this chapter noted that filtering elements that can be very effective are the words ad and ads. With regex it is possible to express this as a single pattern instead of two. We do need some sort of base for regex and in this instance using the string ad as a base to work from is a good start. With Adblock a regex expression has to be bound by regex where regex is the regular forward slash lets Adblock know that we are indeed intending this to be a regular expression and not a simple pattern-matched rule. ad This short snippet is our base for a more selective regex expression. As it stands it is essentially the same filter as ad which removes any advertising element with the substring ad in it. This is an imperfect solution though because it filters out an image called or any other substring with ad in it. Ads do occur in subdirectories though ad might be a subdirectory that should be filtered and is something else that is undesirable but addons is something you want to avoid filtering. For ad subdirectories you don t need to specify the first forward slash you can simply catch the tailing one. The preceding code snippet can be refined to be more selective. First assume that any letter in front of the string ad will make it something that you want to keep. Therefore any nonword alphanumeric character is suspect. Any nonalphanumeric characters are denoted with W this can be thought of as a wildcard specific to symbols. Wad This can be read as a substring that contains ad and immediately in front of it is something that is not part of the alphabet and is not a number. Note that the backslash escapes the W therefore it is not a literal. W is case sensitive as the lowercase w means that it is an alphanumeric which is not what is desired here. The preceding expression can be .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.