stopifnot(glob2rx("abc.*") == "^abc\\.",
glob2rx("a?b.*") == "^a.b\\.",
glob2rx("a?b.*", trim.tail = FALSE) == "^a.b\\..*$",
glob2rx("*.doc") == "^.*\\.doc$",
glob2rx("*.doc", trim.head = TRUE) == "\\.doc$",
glob2rx("*.t*") == "^.*\\.t",
glob2rx("*.t??") == "^.*\\.t..$",
glob2rx("*[*") == "^.*\\["
)
Run the code above in your browser using DataLab