I'm counting the filter rule Http rule using python in the easylist. Can any body give me accurate pattern to match all the filter as I requested like
I want to match all the filter OF "HTTP RULE WITH DONAIN ANCHOR AND DOMAIN TAG "
same as "HTTP RULE WITHOUTź DOMAIN ANCHOR AND TAG " and "HTTP RULE WITH ONLY DOMAIN TAG "
Here is my sample code for matching the filter
Code: Select all
import re
with open("easylist.txt")as f:
contents=f.read()
pattern=re.compile(r"[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+##")
matches=pattern.finditer(contents)
count=sum(1 for match in matches)
print'There are total HTML Rule With Doamin =',count
pattern=re.compile(r'##')
matches=pattern.finditer(contents)
count3=sum(1 for match in matches)
result=count3-count
print'There are total HTML hiding rule without domain is =',result
print'There are total HTML hiding rule with and without domain is
=',result+count
pattern=re.compile(r'\W[||]')
matches=pattern.finditer(contents)
count2=sum(1 for match in matches)
print'There are total HTTP rule with Domain Anchor =',count2
domain tag is represented as "domain="
i have to match for domain tag which is represented as in the file "domain=" so my first question is that whcih patten should i use to match http rule with domain anchor and domain tag ?
2nd question is that which patteren will be used for matching Http rule without domain anchor and domain tag
same as 3rd question that
if i want to match http rule with only domain tag
then what will be the pattern ?
i am using anoconda python 3
your reponse will be highly apreciated.
thanks.