diff --git a/ipn_generator/generator.py b/ipn_generator/generator.py index d50d1dc..353c9af 100644 --- a/ipn_generator/generator.py +++ b/ipn_generator/generator.py @@ -9,6 +9,8 @@ logger = logging.getLogger("inventree") +PERMITTED_SPECIAL_LITERALS = "\-.:/\\" + def validate_pattern(pattern): """Validates pattern groups""" @@ -118,7 +120,7 @@ def construct_regex(self, disable_groups=False): regex = "^" m = re.findall( - r"(\{\d+\+?\})|(\([\w\(\)]+\))|(\[(?:\w+|\w-\w)+\])", + r"(\{\d+\+?\})|(\([\w\(\)\-.:/\\]+\))|(\[(?:\w+|\w-\w)+\])", self.get_setting("PATTERN"), ) @@ -248,7 +250,7 @@ def increment_ipn(self, exp, latest): def construct_first_ipn(self): """No IPNs matching the pattern were found. Constructing the first IPN.""" m = re.findall( - r"(\{\d+\+?\})|(\([\w\(\)]+\))|(\[(?:\w+|(?:\w-\w)+)\])", + r"(\{\d+\+?\})|(\([\w\(\)\-.:/\\]+\))|(\[(?:\w+|(?:\w-\w)+)\])", self.get_setting("PATTERN"), )