library(data.table)
library(stringi)
dt <- readLines("input.txt")
pattern <-
"#([0-9]{1,4}) @ ([0-9]{0,4}),([0-9]{0,4}): ([0-9]{0,4})x([0-9]{0,4})"
dt <-
data.table(do.call(rbind, stri_match_all_regex(dt, pattern)))
colnames(dt) <- c("input", "id", "xPos", "yPos", "xSize", "ySize")
dt <- data.table(apply(dt[, 2:6], 2, as.numeric))
head(dt)
id xPos yPos xSize ySize
1: 1 393 863 11 29
2: 2 675 133 15 26
3: 3 690 605 25 22
4: 4 342 752 19 17
5: 5 840 36 14 18
6: 6 671 653 10 23