Skip to content

Commit

Permalink
expand replace patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Jun 5, 2024
1 parent 451a1c1 commit b2d8904
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kitsunekko_tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ def what(self) -> str:


RE_FILENAME_PROHIBITED = re.compile(r"[ _\\\n\t\r#\[\]{}<>^*/:`?'|]+", flags=re.MULTILINE | re.IGNORECASE)
RE_MULTI_SPACE = re.compile(r" {2,}", flags=re.MULTILINE | re.IGNORECASE)


def fs_name_strip(name: str) -> str:
return re.sub(RE_FILENAME_PROHIBITED, " ", name.replace(":", ".")).strip()
name = name.replace(":", ".")
name = name.replace("??", "2")
name = name.replace("||", "2")
name = re.sub(RE_FILENAME_PROHIBITED, " ", name)
name = re.sub(RE_MULTI_SPACE, " ", name)
return name.strip()

0 comments on commit b2d8904

Please sign in to comment.