diff --git a/R/class-workbook.R b/R/class-workbook.R index 10ddd888a..c461de01d 100644 --- a/R/class-workbook.R +++ b/R/class-workbook.R @@ -658,7 +658,7 @@ wbWorkbook <- R6::R6Class( # sheet name instead of the clone source chart <- self$charts$chart[chartid] - self$charts$rels[chartid] <- gsub("?drawing[0-9].xml", paste0("drawing", chartid, ".xml"), self$charts$rels[chartid]) + self$charts$rels[chartid] <- gsub("?drawing[0-9]+.xml", paste0("drawing", chartid, ".xml"), self$charts$rels[chartid]) guard_ws <- function(x) { if (grepl(" ", x)) x <- shQuote(x, type = "sh") @@ -5996,7 +5996,7 @@ wbWorkbook <- R6::R6Class( stylesInd <- grep("styles\\.xml", self$workbook.xml.rels) themeInd <- grep("theme/theme[0-9]+.xml", self$workbook.xml.rels) connectionsInd <- grep("connections.xml", self$workbook.xml.rels) - customXMLInd <- grep("customXml/item[0-9].xml", self$workbook.xml.rels) + customXMLInd <- grep("customXml/item[0-9]+.xml", self$workbook.xml.rels) extRefInds <- grep("externalLinks/externalLink[0-9]+.xml", self$workbook.xml.rels) sharedStringsInd <- grep("sharedStrings.xml", self$workbook.xml.rels) tableInds <- grep("table[0-9]+.xml", self$workbook.xml.rels) @@ -6006,7 +6006,7 @@ wbWorkbook <- R6::R6Class( ## Reordering of workbook.xml.rels ## don't want to re-assign rIds for pivot tables or slicer caches - pivotNode <- grep("pivotCache/pivotCacheDefinition[0-9].xml", self$workbook.xml.rels, value = TRUE) + pivotNode <- grep("pivotCache/pivotCacheDefinition[0-9]+.xml", self$workbook.xml.rels, value = TRUE) slicerNode <- grep("slicerCache[0-9]+.xml", self$workbook.xml.rels, value = TRUE) ## Reorder children of workbook.xml.rels diff --git a/R/wb_load.R b/R/wb_load.R index 291aa1367..1a56e5c67 100644 --- a/R/wb_load.R +++ b/R/wb_load.R @@ -466,7 +466,7 @@ wb_load <- function(file, xlsxFile = NULL, sheet, data_only = FALSE) { cache_keep <- unlist( regmatches( wb$pivotTables.xml.rels, - gregexpr("(?<=pivotCache/pivotCacheDefinition)[0-9](?=\\.xml)", + gregexpr("(?<=pivotCache/pivotCacheDefinition)[0-9]+(?=\\.xml)", wb$pivotTables.xml.rels, perl = TRUE, ignore.case = TRUE ) @@ -1196,7 +1196,7 @@ wb_load <- function(file, xlsxFile = NULL, sheet, data_only = FALSE) { ) } - for (cstitm in seq_along(grep_xml("customXml/item[0-9].xml"))) { + for (cstitm in seq_along(grep_xml("customXml/item[0-9]+.xml"))) { # TODO provide a function that creates a wb_rels data frame wb_rels <- rbindlist(xml_attr(wb$workbook.xml.rels, "Relationship"))