From 89ea5a3e890cdae1df695b821817cf3388b61731 Mon Sep 17 00:00:00 2001 From: LDericher <40151420+ldericher@users.noreply.github.com> Date: Mon, 23 Aug 2021 16:02:44 +0200 Subject: [PATCH] re optimization --- fftcg/card.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fftcg/card.py b/fftcg/card.py index b1369e2..e8d6009 100644 --- a/fftcg/card.py +++ b/fftcg/card.py @@ -51,17 +51,17 @@ class Card: # place "S" symbols text = text.replace("《S》", encircle_symbol("S", False)) # place other letter and numerical cost symbols - text = re.sub(r"《([a-z0-9])》", sub_encircle, text, flags=re.IGNORECASE) + text = re.sub(r"《([\w])》", sub_encircle, text, flags=re.UNICODE) # place elemental cost symbols - text = re.sub(rf"《([{''.join(Card.__ELEMENTS_JAP)}])》", sub_elements, text, flags=re.IGNORECASE) + text = re.sub(rf"《([{''.join(Card.__ELEMENTS_JAP)}])》", sub_elements, text, flags=re.UNICODE) # place dull symbols text = text.replace("《ダル》", "[⤵]") # replace formatting hints with brackets - text = re.sub(r"\[\[[a-z]]]([^\[]*?)\s*\[\[/]]\s*", r"[\1] ", text, flags=re.IGNORECASE) + text = re.sub(r"\[\[[a-z]]]([^\[]*?)\s*\[\[/]]\s*", r"[\1] ", text, flags=re.IGNORECASE | re.UNICODE) # place EX-BURST markers - text = re.sub(r"\[\[ex]]\s*EX BURST\s*\[\[/]]\s*", r"[EX BURST] ", text, flags=re.IGNORECASE) + text = re.sub(r"\[\[ex]]\s*EX BURST\s*\[\[/]]\s*", r"[EX BURST] ", text, flags=re.IGNORECASE | re.UNICODE) # place line breaks - text = re.sub(r"\s*\[\[br]]\s*", "\n\n", text, flags=re.IGNORECASE) + text = re.sub(r"\s*\[\[br]]\s*", "\n\n", text, flags=re.IGNORECASE | re.UNICODE) return cls( code=Code(data["Code"]),