M
M
mpahpuxgb2017-08-02 21:29:16
Regular Expressions
mpahpuxgb, 2017-08-02 21:29:16

How is address filtering implemented in ad blockers?

To improve my skills, I decided to write my own ad blocker. On the Internet, I found a list of addresses of the form:
site1.ru
*.site2.ru
*.ru/ads/ and so on.
Let's say I get an address like site.ru or thissite.site.ru or site.ru/ad/ or even thissite.site.ru/ad/.
How can I check if this site is eligible for the list? If each time to check by enumeration, then it will take a lot of time (there are about 15,000 lines in the list). There was an idea to check using an associative array, but this will only work if there is a complete match.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Dart, 2019-03-10
@skapunker

In your case, this is For general development in regular seasons, study: https://www.youtube.com/watch?v=0rwYISzL-c8&list=P...

D
Dmitry, 2019-03-10
@slo_nik

Good morning.
Try starting with this .

L
longclaps, 2017-08-02
@mpahpuxgb

Read - read - read .

X
xmoonlight, 2017-08-02
@xmoonlight

Tree (character-by-character clustering into nodes)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question