mirror of
https://github.com/PaiGramTeam/genshin-wiki.git
synced 2024-11-22 07:07:40 +00:00
15 lines
323 B
Python
15 lines
323 B
Python
|
try:
|
||
|
import regex as re
|
||
|
except ImportError:
|
||
|
import re
|
||
|
|
||
|
__all__ = ("remove_rich_tag",)
|
||
|
|
||
|
|
||
|
def remove_rich_tag(string: str | None) -> str:
|
||
|
"""去除富文本标签"""
|
||
|
if string is not None:
|
||
|
return re.sub(
|
||
|
r"(<(?P<tag_name>[a-z]+?)=(?P<value>.+?)>.+?</(?P=tag_name)>)", "", string
|
||
|
)
|