mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-12-23 13:13:00 +00:00
rename RE constants
This commit is contained in:
parent
878bf34d52
commit
ae9ca16aaa
1 changed files with 5 additions and 5 deletions
|
@ -4,11 +4,11 @@ from random import Random
|
|||
|
||||
from pydantic import BaseModel, field_validator
|
||||
|
||||
_RE_WHITESPACE = re.compile(
|
||||
RE_WHITESPACE = re.compile(
|
||||
pattern=r"\s+",
|
||||
flags=re.UNICODE | re.IGNORECASE,
|
||||
)
|
||||
_RE_SPECIAL_CHARS = re.compile(
|
||||
RE_SPECIAL_CHARS = re.compile(
|
||||
pattern=r"[^a-zA-Z0-9\s]+",
|
||||
flags=re.UNICODE | re.IGNORECASE,
|
||||
)
|
||||
|
@ -67,14 +67,14 @@ class TransformedString(BaseModel):
|
|||
result = result.strip()
|
||||
|
||||
elif self.whitespace is TransformedString.__Whitespace.SPACE:
|
||||
result = _RE_WHITESPACE.sub(string=result, repl=" ")
|
||||
result = RE_WHITESPACE.sub(string=result, repl=" ")
|
||||
|
||||
elif self.whitespace is TransformedString.__Whitespace.REMOVE:
|
||||
result = _RE_WHITESPACE.sub(string=result, repl="")
|
||||
result = RE_WHITESPACE.sub(string=result, repl="")
|
||||
|
||||
# Sonderzeichen verarbeiten
|
||||
if self.special_chars is TransformedString.__SpecialChars.REMOVE:
|
||||
result = _RE_SPECIAL_CHARS.sub(string=result, repl="")
|
||||
result = RE_SPECIAL_CHARS.sub(string=result, repl="")
|
||||
|
||||
# Groß-/Kleinschreibung verarbeiten
|
||||
if self.case is TransformedString.__Case.UPPER:
|
||||
|
|
Loading…
Reference in a new issue