| Encoding: UTF-8 | Encoding: UTF-8 | ||||
| LazyData: true | LazyData: true | ||||
| Roxygen: list(markdown = TRUE) | Roxygen: list(markdown = TRUE) | ||||
| RoxygenNote: 7.1.0 | |||||
| RoxygenNote: 7.1.1 |
| #' @param pattern Regular Expression to edit or visualize using RegExplain | #' @param pattern Regular Expression to edit or visualize using RegExplain | ||||
| #' @param start_page Open gadget to this tab, one of `"Text"`, `"RegEx"`, | #' @param start_page Open gadget to this tab, one of `"Text"`, `"RegEx"`, | ||||
| #' `"Output"`, or `"Help"` | #' `"Output"`, or `"Help"` | ||||
| #' | |||||
| #' @return The regular expression built in the app is returned as a character | |||||
| #' string. | |||||
| #' @export | #' @export | ||||
| regexplain_gadget <- function( | regexplain_gadget <- function( | ||||
| text = NULL, | text = NULL, |
| # ---- Server - Tab - Exit ---- | # ---- Server - Tab - Exit ---- | ||||
| observeEvent(input$done, { | observeEvent(input$done, { | ||||
| if (pattern() != "") { | if (pattern() != "") { | ||||
| pattern <- paste0('pattern <- "', escape_backslash(pattern()), '"') | |||||
| regexp <- escape_backslash(pattern()) | |||||
| pattern <- paste0('pattern <- "', regexp, '"') | |||||
| if (any(c("perl", "fixed", "ignore.case", "useBytes") %in% input$regex_options)) { | if (any(c("perl", "fixed", "ignore.case", "useBytes") %in% input$regex_options)) { | ||||
| options <- input$regex_options[!input$regex_options %in% c("text_break_lines", "global")] | options <- input$regex_options[!input$regex_options %in% c("text_break_lines", "global")] | ||||
| options <- paste0(options, "=TRUE", collapse = ", ") | options <- paste0(options, "=TRUE", collapse = ", ") | ||||
| } | } | ||||
| rstudioapi::sendToConsole(pattern, FALSE) | rstudioapi::sendToConsole(pattern, FALSE) | ||||
| } | } | ||||
| stopApp() | |||||
| stopApp(regexp) | |||||
| }) | }) | ||||
| observeEvent(input$cancel, { | observeEvent(input$cancel, { |
| % Generated by roxygen2: do not edit by hand | |||||
| % Please edit documentation in R/regexplain-deprecated.R | |||||
| \name{regexplain-deprecated} | |||||
| \alias{regexplain-deprecated} | |||||
| \alias{regex_gadget} | |||||
| \title{Deprecated or renamed functions} | |||||
| \usage{ | |||||
| regex_gadget(...) | |||||
| } | |||||
| \arguments{ | |||||
| \item{...}{Arguments passed to the new or renamed functions.} | |||||
| } | |||||
| \value{ | |||||
| The result of the new or renamed function. | |||||
| } | |||||
| \description{ | |||||
| These functions in regexplain have been deprecated or renamed. | |||||
| Use \code{\link[=regexplain_gadget]{regexplain_gadget()}} instead of \code{regex_gadget()}. | |||||
| } | |||||
| \keyword{internal} |
| See \code{\link[shiny:enableBookmarking]{enableBookmarking()}} for more information.} | See \code{\link[shiny:enableBookmarking]{enableBookmarking()}} for more information.} | ||||
| }} | }} | ||||
| } | } | ||||
| \value{ | |||||
| The regular expression built in the app is returned as a character | |||||
| string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| The function behind the RegExplain Selection and RegExplain File | The function behind the RegExplain Selection and RegExplain File | ||||
| addins. Opens the RegExplain gadget interface in an RStudio viewer | addins. Opens the RegExplain gadget interface in an RStudio viewer |
| \item{pattern}{Regex pattern to look for} | \item{pattern}{Regex pattern to look for} | ||||
| \item{...}{ | \item{...}{ | ||||
| Arguments passed on to \code{\link[base:regexec]{base::regexec}} | |||||
| Arguments passed on to \code{\link[base:grep]{base::regexec}} | |||||
| \describe{ | \describe{ | ||||
| \item{\code{ignore.case}}{if \code{FALSE}, the pattern matching is \emph{case | \item{\code{ignore.case}}{if \code{FALSE}, the pattern matching is \emph{case | ||||
| sensitive} and if \code{TRUE}, case is ignored during matching.} | sensitive} and if \code{TRUE}, case is ignored during matching.} | ||||
| If the output is destined for a \link{knitr} document, set \code{knitr} to \code{TRUE}. | If the output is destined for a \link{knitr} document, set \code{knitr} to \code{TRUE}. | ||||
| } | } | ||||
| \examples{ | \examples{ | ||||
| view_regex("example", "amp", render=FALSE) | |||||
| view_regex("example", "amp", render = FALSE) | |||||
| } | } |