- // Does the timestamp format contain brackets? For example:
- // Classic: "[hh:mm:ss]"
- // Modern: " hh:mm:ss"
- //
- // Match groups of any opening or closing brackets - (), {}, [], <>, (>, {], etc:
- // ^\s*[({[<].+[)}\]>]\s*$
- // [...] is a character group containing ...
- // ^ matches start of string
- // \s* matches any amount of whitespace
- // [({[<] matches (, {, [, or <
- // .+ matches one or more characters
- // [)}\]>] matches ), }, ], or >, escaping the ]
- // $ matches end of string
- // Alternatively, if opening and closing brackets must be in pairs, use this:
- // (^\s*\(.+\)\s*$)|(^\s*\{.+\}\s*$)|(^\s*\[.+\]\s*$)|(^\s*<.+>\s*$)
- // Note that '\' must be escaped as '\\'
- // Helpful interactive website for debugging and explaining: https://regex101.com/
- const QRegExp regExpMatchBrackets("^\\s*[({[<].+[)}\\]>]\\s*$");
- _timestampHasBrackets = regExpMatchBrackets.exactMatch(_timestampFormatString);
+ if (!_useCustomTimestampFormat) {
+ // The default timestamp format string does not have brackets, no need to check.
+ // If UiStyle::updateSystemTimestampFormat() has brackets added, change this, too.
+ _timestampHasBrackets = false;
+ } else {
+ // Does the timestamp format contain brackets? For example:
+ // Classic: "[hh:mm:ss]"
+ // Modern: " hh:mm:ss"
+ //
+ // Match groups of any opening or closing brackets - (), {}, [], <>, (>, {], etc:
+ // ^\s*[({[<].+[)}\]>]\s*$
+ // [...] is a character group containing ...
+ // ^ matches start of string
+ // \s* matches any amount of whitespace
+ // [({[<] matches (, {, [, or <
+ // .+ matches one or more characters
+ // [)}\]>] matches ), }, ], or >, escaping the ]
+ // $ matches end of string
+ // Alternatively, if opening and closing brackets must be in pairs, use this:
+ // (^\s*\(.+\)\s*$)|(^\s*\{.+\}\s*$)|(^\s*\[.+\]\s*$)|(^\s*<.+>\s*$)
+ // Note that '\' must be escaped as '\\'
+ // Helpful interactive website for debugging and explaining: https://regex101.com/
+ const QRegExp regExpMatchBrackets("^\\s*[({[<].+[)}\\]>]\\s*$");
+ _timestampHasBrackets = regExpMatchBrackets.exactMatch(_timestampFormatString);
+ }