Quoting directly from regex101regex101 - a great page for testing and explaining regular expressions:
/^NAME.log(-\d+)?$/ ^assert position at start of the stringNAMEmatches the characters NAME literally (case sensitive).matches any character (except newline)logmatches the characters log literally (case sensitive)
Capturing group (-\d+)?
- Quantifier:
?Between zero and one time, as many times as possible, giving back as needed [greedy] -matches the character - literally\dmatch a digit [0-9]- Quantifier:
+Between one and unlimited times, as many times as possible, giving back as needed [greedy] $assert position at end of the string
So basically, this searches for strings (particularly file names I suppose) matching the pattern NAME.log or NAME.log-123456789 (no limit on number of digits).
Most probably it should be changed to match literal dot instead of "any character", so a backslash (\) should be added before the dot in the expression.