fork download
  1. text <- "\\examples{afunction(x = list()){\nx<-3\n}y<-2 server <- function(input, output, session) {\n output$res_bttn1 <- renderPrint({input$bttn1})\n}\n}"
  2. pattern = "\\\\examples({([^{}]*?(?:(?1)[^{}]*?)*)\\s*})"
  3. unlist(regmatches(text, regexec(pattern, text, perl=TRUE)))[3]
Success #stdin #stdout 0.27s 39044KB
stdin
Standard input is empty
stdout
[1] "afunction(x = list()){\nx<-3\n}y<-2 server <- function(input, output, session) {\n  output$res_bttn1 <- renderPrint({input$bttn1})\n}"