Closed GoogleCodeExporter closed 8 years ago
重构猎豹版转换,未完成的处理模块
if re.search('$', line):
#先分类,分成非选项和过滤规则选项
dotmatch = re.search(r'^([^$]*)(.*)$), line)
dotdomain = dotmatch.group(1)
dotother = dotmatch.group(2)
#先像普通规则那样处理非选项
dotdomain = re.sub('.', '\.', dotdomain)
dotdomain = re.sub(r'\|$', '$' ,dotdomain)
dotdomain = re.sub('/', '\/', dotdomain)
dotdomain = re.sub('*', '\*', dotdomain)
dotdomain = re.sub('?', '\?', dotdomain)
dotdomain = re.sub(r'^\|\|', '/:\/\/([^\/]+\.)?', dotdomain)
#再处理过滤规则选项
dotother = re.sub('object-subrequest', 'object', dotother)
dotother = re.sub('subdocument', 'document', dotother)
dotother = re.sub('subdocument', 'document', dotother)
dotother = re.sub(',', '|', dotother)
if re.search(r'\$.*\$', dotother):
dotother = re.sub(r' $w', ',$w', dotother)
line = dotdomain + ' ' + dotother
else:
line = re.sub('.', '\.', line)
line = re.sub(r'\|$', '$' ,line)
line = re.sub('/', '\/', line)
line = re.sub('*', '\*', line)
line = re.sub('?', '\?', line)
line = re.sub(r'^\|\|', '/:\/\/([^\/]+\.)?', line)
Original comment by hc5023295
on 8 Feb 2013 at 6:18
完成于 r889
Original comment by hc5023295
on 8 Feb 2013 at 11:47
Original issue reported on code.google.com by
hc5023295
on 7 Feb 2013 at 2:22