Fix regexp for AddedExtractor

This commit is contained in:
mariom 2023-01-18 15:45:59 +01:00
parent 046331748c
commit 7bbb3ece62
1 changed files with 2 additions and 2 deletions

View File

@ -14,9 +14,9 @@ func (e addedExtractor) Matches(line string) bool {
}
func (e addedExtractor) Extract(metadata *BackupLogMetadata, line string) {
// Sample line: "Added to the repo: 0 B"
metadata.AddedSize = strings.TrimSpace(e.re.ReplaceAllString(line, ""))
metadata.AddedSize = strings.TrimSpace(e.re.ReplaceAllString(line, "$2"))
}
func NewAddedExtractor() MetadatExtractor {
return addedExtractor{regexp.MustCompile(`(?i)^Added to the repo:`)}
return addedExtractor{regexp.MustCompile(`(?i)^Added to the repo(sitory)?: ([\d\.]+ \w+)( \([\d\.]+[\w\s]+\))?`)}
}