Adguard Converter : Support some others regex
This commit is contained in:
parent
1ead434734
commit
0aa0c982fa
@ -6,7 +6,16 @@ from shutil import copyfile
|
||||
infile = sys.argv[1]
|
||||
outfile = sys.argv[2]
|
||||
|
||||
a = ['||','^']
|
||||
with open(infile) as f:
|
||||
file = f.read().split('\n')
|
||||
for i in range(len(file)):
|
||||
file[i] = re.sub('(..*#..*)|(@@\|\|..*)|(\|\|..*\/..*)|(^\/..*)|(^..*\$app=..*)|(^..*\$removeparam=..*)|(^..\/..*)|(\$..*)|(^\...*)|(^:..*)|(^\|http)|(^@@..*)|(^_..*)|(\*..*)', '', file[i])
|
||||
#print(file)
|
||||
with open(infile, 'w') as f1:
|
||||
f1.writelines(["%s\n" % item for item in file])
|
||||
f.close()
|
||||
|
||||
a = ['||','^','|']
|
||||
lst = []
|
||||
|
||||
with open(infile, 'r') as f:
|
||||
|
@ -1,11 +1,20 @@
|
||||
import os
|
||||
import sys
|
||||
from re import sub
|
||||
import re
|
||||
from shutil import copyfile
|
||||
|
||||
infile = sys.argv[1]
|
||||
outfile = sys.argv[2]
|
||||
|
||||
with open(infile) as f:
|
||||
file = f.read().split('\n')
|
||||
for i in range(len(file)):
|
||||
file[i] = re.sub('(..*#..*)|(@@\|\|..*)|(\|\|..*\/..*)|(^\/..*)|(^..*\$app=..*)|(^..*\$removeparam=..*)|(^..\/..*)|(\$..*)|(^\...*)|(^:..*)|(^\|http)|(^@@..*)|(^_..*)|(\*..*)', '', file[i])
|
||||
#print(file)
|
||||
with open(infile, 'w') as f1:
|
||||
f1.writelines(["%s\n" % item for item in file])
|
||||
f.close()
|
||||
|
||||
a = ['||','^','|']
|
||||
lst = []
|
||||
|
||||
@ -24,7 +33,7 @@ f.close()
|
||||
with open(infile) as f:
|
||||
file = f.read().split('\n')
|
||||
for i in range(len(file)):
|
||||
file[i] = sub(r'!', ';', file[i])
|
||||
file[i] = re.sub(r'!', ';', file[i])
|
||||
#print(file)
|
||||
with open(infile, 'w') as f1:
|
||||
f1.writelines(["%s\n" % item for item in file])
|
||||
@ -48,7 +57,7 @@ f.close()
|
||||
with open(infile) as f:
|
||||
file = f.read().split('\n')
|
||||
for i in range(len(file)):
|
||||
file[i] = sub('^@@', '', file[i])
|
||||
file[i] = re.sub('^@@', '', file[i])
|
||||
#print(file)
|
||||
with open(infile, 'w') as f1:
|
||||
f1.writelines(["%s\n" % item for item in file])
|
||||
|
Loading…
Reference in New Issue
Block a user