diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index 360213ba3a..5c6264fc5a 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -473,7 +473,7 @@ def iter_to_str(iterable, sep=",", endsep=", and", addquote=False): list_to_string = iter_to_str iter_to_string = iter_to_str -re_empty = re.compile("\n\s*\n") +re_empty = re.compile("\n\\s*\n") def compress_whitespace(text, max_linebreaks=1, max_spacing=2): @@ -494,7 +494,7 @@ def compress_whitespace(text, max_linebreaks=1, max_spacing=2): # this allows the blank-line compression to eliminate them if needed text = re_empty.sub("\n\n", text) # replace groups of extra spaces with the maximum number of spaces - text = re.sub(f"(?<=\S) {{{max_spacing},}}", " " * max_spacing, text) + text = re.sub(fr"(?<=\S) {{{max_spacing},}}", " " * max_spacing, text) # replace groups of extra newlines with the maximum number of newlines text = re.sub(f"\n{{{max_linebreaks},}}", "\n" * max_linebreaks, text) return text