mirror of
https://github.com/FutaGuard/LowTechFilter.git
synced 2025-06-21 05:21:02 +08:00
解決 wildcard 問題
This commit is contained in:
parent
ac3ac2b63a
commit
5f29a595f0
@ -79,9 +79,10 @@ async def to_hosts(filename: str, data: str, newversion: str):
|
||||
with open(newfilename, "w") as output:
|
||||
if name == "hosts":
|
||||
pattern = r"(?<=^\|\|)\S+\.\S{2,}(?=\^)"
|
||||
newoutput = "\n".join(
|
||||
"0.0.0.0 " + e for e in re.findall(pattern, newdata, re.MULTILINE)
|
||||
)
|
||||
newoutput = ""
|
||||
for e in re.findall(pattern, newdata, re.MULTILINE):
|
||||
if "*" not in e:
|
||||
newoutput += "0.0.0.0 " + e + "\n"
|
||||
else:
|
||||
newoutput = "\n".join("0.0.0.0 " + e for e in data)
|
||||
output.write(newhead)
|
||||
|
Loading…
x
Reference in New Issue
Block a user