diff --git a/cron/lifecycle_guard.py b/cron/lifecycle_guard.py index 9e9e4f41d5..f145d4db8d 100644 --- a/cron/lifecycle_guard.py +++ b/cron/lifecycle_guard.py @@ -247,11 +247,11 @@ _PROFILE_FLAG_LIFECYCLE_PATTERN = re.compile( r"(?i)" r"hermes\s+" # Any global flags before the profile selector (each may carry a value). - r"(?:-{1,2}\S+(?:\s+\S+)?\s+)*" + r"(?:-{1,2}\S+(?:\s+(?!-)\S+)?\s+){0,12}" # The selector: exactly the shapes the CLI's `_apply_profile_override` accepts. r"(?:--profile=([^\s]+)|(?:-p|--profile)\s+([^\s]+))" # Any global flags between the selector and the subcommand. - r"(?:\s+-{1,2}\S+(?:\s+\S+)?)*" + r"(?:\s+-{1,2}\S+(?:\s+(?!-)\S+)?){0,12}" r"\s+gateway\s+(?:restart|stop)" )