diff options
-rw-r--r-- | cmd2/parsing.py | 4 | ||||
-rw-r--r-- | cmd2/utils.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py index 6c687439..e90eac43 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -34,12 +34,12 @@ class MacroArg: # Pattern used to find normal argument # Digits surrounded by exactly 1 brace on a side and 1 or more braces on the opposite side # Match strings like: {5}, {{{{{4}, {2}}}}} - macro_normal_arg_pattern = re.compile(r'(?<!\{)\{\d+\}|\{\d+\}(?!\})') + macro_normal_arg_pattern = re.compile(r'(?<!{){\d+}|{\d+}(?!})') # Pattern used to find escaped arguments # Digits surrounded by 2 or more braces on both sides # Match strings like: {{5}}, {{{{{4}}, {{2}}}}} - macro_escaped_arg_pattern = re.compile(r'\{{2}\d+\}{2}') + macro_escaped_arg_pattern = re.compile(r'{{2}\d+}{2}') # Finds a string of digits digit_pattern = re.compile(r'\d+') diff --git a/cmd2/utils.py b/cmd2/utils.py index 7f7a9b48..ddd43507 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -229,7 +229,7 @@ def natural_keys(input_str: str) -> List[Union[int, str]]: :param input_str: string to convert :return: list of strings and integers """ - return [try_int_or_force_to_lower_case(substr) for substr in re.split('(\d+)', input_str)] + return [try_int_or_force_to_lower_case(substr) for substr in re.split(r'(\d+)', input_str)] def natural_sort(list_to_sort: Iterable[str]) -> List[str]: |