fork download
  1. texfile <- "\\caption[SOME WORDS]"
  2. ## -> \caption[\textit{SOME WORDS}]
  3. texfile <-gsub('\\Q\\caption[\\E\\K([^][]*)]','\\\\textit{\\1}]', texfile, perl=TRUE)
  4. cat(texfile)
Success #stdin #stdout 0.31s 38708KB
stdin
Standard input is empty
stdout
\caption[\textit{SOME WORDS}]