├── .Rbuildignore ├── .Rprofile ├── .codecov.yml ├── .gitignore ├── .lintr ├── .travis.yml ├── CRAN-SUBMISSION ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── R ├── app_config.R ├── app_server.R ├── app_ui.R ├── build_r_snippet.R ├── build_save_url.R ├── get_match_list.R ├── golem_utils_ui.R ├── highlight_r_code.R ├── highlight_test_str.R ├── html_format_match_list.R ├── mgsub.R ├── parse_url_params.R ├── regexplain.R ├── run_app.R ├── slash_utils.R └── try_default.R ├── README.md ├── app.R ├── cran-comments.md ├── inst ├── app │ └── www │ │ ├── favicon.png │ │ ├── ga_tag.html │ │ ├── logo.png │ │ ├── regex_cheatsheet.pdf │ │ └── regex_documentation.html └── golem-config.yml ├── man └── run_app.Rd ├── packrat ├── init.R ├── packrat.lock ├── packrat.opts └── src │ ├── BH │ └── BH_1.72.0-3.tar.gz │ ├── DT │ └── DT_0.13.tar.gz │ ├── R6 │ └── R6_2.4.1.tar.gz │ ├── RColorBrewer │ └── RColorBrewer_1.1-2.tar.gz │ ├── Rcpp │ └── Rcpp_1.0.4.6.tar.gz │ ├── askpass │ └── askpass_1.1.tar.gz │ ├── assertthat │ └── assertthat_0.2.1.tar.gz │ ├── attempt │ └── attempt_0.3.1.tar.gz │ ├── backports │ └── backports_1.1.7.tar.gz │ ├── brew │ └── brew_1.0-6.tar.gz │ ├── callr │ └── callr_3.4.3.tar.gz │ ├── cli │ └── cli_2.0.2.tar.gz │ ├── clipr │ └── clipr_0.7.0.tar.gz │ ├── commonmark │ └── commonmark_1.7.tar.gz │ ├── config │ └── config_0.3.tar.gz │ ├── crayon │ └── crayon_1.3.4.tar.gz │ ├── crosstalk │ └── crosstalk_1.1.0.1.tar.gz │ ├── curl │ └── curl_4.3.tar.gz │ ├── data.table │ └── data.table_1.12.8.tar.gz │ ├── desc │ └── desc_1.2.0.tar.gz │ ├── digest │ └── digest_0.6.25.tar.gz │ ├── dockerfiler │ └── dockerfiler_0.1.3.tar.gz │ ├── dplyr │ └── dplyr_1.0.0.tar.gz │ ├── ellipsis │ └── ellipsis_0.3.1.tar.gz │ ├── evaluate │ └── evaluate_0.14.tar.gz │ ├── fansi │ └── fansi_0.4.1.tar.gz │ ├── fastmap │ └── fastmap_1.0.1.tar.gz │ ├── fs │ └── fs_1.4.1.tar.gz │ ├── generics │ └── generics_0.0.2.tar.gz │ ├── gh │ └── gh_1.1.0.tar.gz │ ├── git2r │ └── git2r_0.27.1.tar.gz │ ├── glue │ └── glue_1.4.1.tar.gz │ ├── golem │ └── golem_0.2.1.tar.gz │ ├── here │ └── here_0.1.tar.gz │ ├── highr │ └── highr_0.8.tar.gz │ ├── htmltools │ └── htmltools_0.4.0.tar.gz │ ├── htmlwidgets │ └── htmlwidgets_1.5.1.tar.gz │ ├── httpuv │ └── httpuv_1.5.3.1.tar.gz │ ├── httr │ └── httr_1.4.1.tar.gz │ ├── ini │ └── ini_0.3.1.tar.gz │ ├── jsonlite │ └── jsonlite_1.6.1.tar.gz │ ├── knitr │ └── knitr_1.28.tar.gz │ ├── later │ └── later_1.0.0.tar.gz │ ├── lazyeval │ └── lazyeval_0.2.2.tar.gz │ ├── lifecycle │ └── lifecycle_0.2.0.tar.gz │ ├── magrittr │ └── magrittr_1.5.tar.gz │ ├── markdown │ └── markdown_1.1.tar.gz │ ├── mime │ └── mime_0.9.tar.gz │ ├── openssl │ └── openssl_1.4.1.tar.gz │ ├── packrat │ └── packrat_0.5.0.tar.gz │ ├── pillar │ └── pillar_1.4.4.tar.gz │ ├── pkgbuild │ └── pkgbuild_1.0.8.tar.gz │ ├── pkgconfig │ └── pkgconfig_2.0.3.tar.gz │ ├── pkgload │ └── pkgload_1.0.2.tar.gz │ ├── praise │ └── praise_1.0.0.tar.gz │ ├── prettyunits │ └── prettyunits_1.1.1.tar.gz │ ├── processx │ └── processx_3.4.2.tar.gz │ ├── promises │ └── promises_1.1.0.tar.gz │ ├── ps │ └── ps_1.3.3.tar.gz │ ├── purrr │ └── purrr_0.3.4.tar.gz │ ├── rematch2 │ └── rematch2_2.1.2.tar.gz │ ├── remotes │ └── remotes_2.1.1.tar.gz │ ├── rlang │ └── rlang_0.4.6.tar.gz │ ├── roxygen2 │ └── roxygen2_7.1.0.tar.gz │ ├── rprojroot │ └── rprojroot_1.3-2.tar.gz │ ├── rstudioapi │ └── rstudioapi_0.11.tar.gz │ ├── rvest │ └── rvest_0.3.5.tar.gz │ ├── selectr │ └── selectr_0.4-2.tar.gz │ ├── shiny │ └── shiny_1.4.0.2.tar.gz │ ├── shinyBS │ └── shinyBS_0.61.tar.gz │ ├── shinythemes │ └── shinythemes_1.1.2.tar.gz │ ├── sourcetools │ └── sourcetools_0.1.7.tar.gz │ ├── stringi │ └── stringi_1.4.6.tar.gz │ ├── stringr │ └── stringr_1.4.0.tar.gz │ ├── sys │ └── sys_3.3.tar.gz │ ├── testthat │ └── testthat_2.3.2.tar.gz │ ├── tibble │ └── tibble_3.0.1.tar.gz │ ├── tidyr │ └── tidyr_1.1.0.tar.gz │ ├── tidyselect │ └── tidyselect_1.1.0.tar.gz │ ├── usethis │ └── usethis_1.6.1.tar.gz │ ├── utf8 │ └── utf8_1.1.4.tar.gz │ ├── vctrs │ └── vctrs_0.3.0.tar.gz │ ├── whisker │ └── whisker_0.4.tar.gz │ ├── withr │ └── withr_2.2.0.tar.gz │ ├── xfun │ └── xfun_0.14.tar.gz │ ├── xml2 │ └── xml2_1.3.2.tar.gz │ ├── xtable │ └── xtable_1.8-4.tar.gz │ └── yaml │ └── yaml_2.2.1.tar.gz ├── r_regex_tester_app.Rproj ├── readme └── r_regex_app_screenshot.png ├── rsconnect └── shinyapps.io │ └── spannbaueradam │ ├── r_regex_tester.dcf │ └── r_regex_tester_app.dcf └── tests ├── testthat.R └── testthat ├── test-get_match_list.R ├── test-golem-recommended.R ├── test-half_slashes.R ├── test-highlight_test_str.R ├── test-html_format_match_list.R ├── test-regexplain.R └── test-try_default.R /.Rbuildignore: -------------------------------------------------------------------------------- 1 | \.lintr 2 | \.travis.yml 3 | \.codecov.yml 4 | readme 5 | ^.*\.Rproj$ 6 | ^\.Rproj\.user$ 7 | ^data-raw$ 8 | dev_history.R 9 | ^dev$ 10 | $run_dev.* 11 | ^LICENSE\.md$ 12 | ^app\.R$ 13 | ^rsconnect$ 14 | ^packrat/ 15 | ^\.Rprofile$ 16 | ^codecov\.yml$ 17 | ^cran-comments\.md$ 18 | ^CRAN-RELEASE$ 19 | ^CRAN-SUBMISSION$ 20 | -------------------------------------------------------------------------------- /.Rprofile: -------------------------------------------------------------------------------- 1 | #### -- Packrat Autoloader (version 0.5.0) -- #### 2 | source("packrat/init.R") 3 | #### -- End Packrat Autoloader -- #### 4 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: true 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # favicon original 2 | *.key 3 | CRAN-RELEASE 4 | 5 | # History files 6 | .Rhistory 7 | .Rapp.history 8 | 9 | # Session Data files 10 | .RData 11 | 12 | # Example code in package build process 13 | *-Ex.R 14 | 15 | # Output files from R CMD build 16 | /*.tar.gz 17 | 18 | # Output files from R CMD check 19 | /*.Rcheck/ 20 | 21 | # RStudio files 22 | .Rproj.user/ 23 | 24 | # produced vignettes 25 | vignettes/*.html 26 | vignettes/*.pdf 27 | 28 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 29 | .httr-oauth 30 | 31 | # knitr and R markdown default cache directories 32 | /*_cache/ 33 | /cache/ 34 | 35 | # Temporary files created by R markdown 36 | *.utf8.md 37 | *.knit.md 38 | .Rproj.user 39 | packrat/lib*/ 40 | -------------------------------------------------------------------------------- /.lintr: -------------------------------------------------------------------------------- 1 | linters: with_defaults(assignment_linter = NULL, line_length_linter = NULL) 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: R 2 | sudo: false 3 | cache: packages 4 | r: 5 | - release 6 | - devel 7 | 8 | r_packages: 9 | - lintr 10 | - covr 11 | 12 | after_success: 13 | - Rscript -e 'covr::codecov(function_exclusions = c("app_server", "run_app", "app_config", "get_golem_config"))' 14 | - R CMD INSTALL $PKG_TARBALL 15 | - Rscript -e 'lintr::lint_package()' 16 | -------------------------------------------------------------------------------- /CRAN-SUBMISSION: -------------------------------------------------------------------------------- 1 | Version: 0.1.3 2 | Date: 2022-01-03 13:13:11 UTC 3 | SHA: 0aac6694af13dc61a9b5ce277bec4761b23b3220 4 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: regexTestR 2 | Title: A 'Shiny' App to Test Regular Expressions in an R Environment 3 | Version: 0.2.1 4 | Authors@R: person('Adam', 'Spannbauer', email = 'spannbaueradam@gmail.com', role = c('cre', 'aut')) 5 | Description: A 'Shiny' app to aid in writing, explaining, and debugging regular expressions in an R environment. 6 | License: MIT + file LICENSE 7 | Imports: 8 | config, 9 | DT, 10 | RColorBrewer, 11 | golem, 12 | shiny, 13 | shinyBS, 14 | shinythemes, 15 | processx, 16 | htmltools, 17 | data.table, 18 | stringr, 19 | tidyr, 20 | pkgload, 21 | rvest, 22 | xml2, 23 | purrr 24 | Encoding: UTF-8 25 | LazyData: true 26 | RoxygenNote: 7.1.2 27 | URL: https://github.com/AdamSpannbauer/r_regex_tester_app 28 | BugReports: https://github.com/AdamSpannbauer/r_regex_tester_app/issues 29 | Suggests: 30 | testthat, 31 | covr 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2020 2 | COPYRIGHT HOLDER: Adam Spannbauer 3 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(run_app) 4 | import(shiny) 5 | importFrom(config,get) 6 | importFrom(data.table,":=") 7 | importFrom(data.table,.SD) 8 | importFrom(golem,activate_js) 9 | importFrom(golem,add_resource_path) 10 | importFrom(golem,bundle_resources) 11 | importFrom(golem,favicon) 12 | importFrom(golem,with_golem_options) 13 | importFrom(htmltools,HTML) 14 | importFrom(shiny,column) 15 | importFrom(shiny,shinyApp) 16 | importFrom(utils,URLdecode) 17 | importFrom(utils,URLencode) 18 | -------------------------------------------------------------------------------- /R/app_config.R: -------------------------------------------------------------------------------- 1 | #' Access files in the current app 2 | #' 3 | #' @param ... Character vector specifying directory and or file to 4 | #' point to inside the current package. 5 | #' 6 | #' @noRd 7 | app_sys <- function(...) { 8 | system.file(..., package = "regexTestR") 9 | } 10 | 11 | 12 | #' Read App Config 13 | #' 14 | #' @param value Value to retrieve from the config file. 15 | #' @param config R_CONFIG_ACTIVE value. 16 | #' @param use_parent Logical, scan the parent directory for config file. 17 | #' 18 | #' @importFrom config get 19 | #' 20 | #' @noRd 21 | get_golem_config <- function(value, 22 | config = Sys.getenv("R_CONFIG_ACTIVE", "default"), 23 | use_parent = TRUE) { 24 | config::get( 25 | value = value, 26 | config = config, 27 | # Modify this if your config file is somewhere else: 28 | file = app_sys("golem-config.yml"), 29 | use_parent = use_parent 30 | ) 31 | } 32 | -------------------------------------------------------------------------------- /R/app_server.R: -------------------------------------------------------------------------------- 1 | #' The application server-side 2 | #' 3 | #' @param input,output,session Internal parameters for {shiny}. 4 | #' DO NOT REMOVE. 5 | #' @import shiny 6 | #' @importFrom utils URLdecode 7 | #' @importFrom utils URLencode 8 | #' @noRd 9 | app_server <- function(input, output, session) { 10 | shiny::observe({ 11 | parse_url_and_update_inputs(session) 12 | }) 13 | 14 | shiny::observeEvent(input$save_button, { 15 | save_url <- build_save_url(session, input) 16 | 17 | shiny::showModal( 18 | shiny::modalDialog( 19 | title = "Saved at this URL:", 20 | shiny::div( 21 | shiny::tags$p( 22 | id = "save_url_copy", 23 | save_url, 24 | style = "white-space: nowrap; font-family: monospace;" 25 | ), 26 | style = "background-color: #EBEBEB; overflow-x: scroll; border-radius: 5px; padding: 5px; padding-top: 10px; border-style: solid; border-width: thin;" 27 | ), 28 | easyClose = TRUE, 29 | footer = shiny::div( 30 | shiny::fluidRow( 31 | shiny::actionButton( 32 | "copy_save_url_button", 33 | "Copy URL", 34 | icon = shiny::icon("clipboard"), 35 | onclick = "copySaveUrlToClipboard()" 36 | ), 37 | shiny::actionButton( 38 | "dismiss_modal", 39 | "Close", 40 | icon = shiny::icon("close"), 41 | "data-dismiss" = "modal" 42 | ) 43 | ) 44 | ) 45 | ) 46 | ) 47 | }) 48 | 49 | safe_half_slashes <- try_default(half_slashes) 50 | safe_get_match_list <- try_default(get_match_list) 51 | safe_html_format_match_list <- try_default(html_format_match_list) 52 | safe_highlight_test_str <- try_default(highlight_test_str) 53 | safe_regexplain <- try_default(regexplain) 54 | 55 | 56 | bad_slash <- shiny::reactive({ 57 | ( 58 | !("pattern" %in% input$auto_escape_check_group) & 59 | is.null(safe_half_slashes(input$pattern)) 60 | ) | ( 61 | !("test_str" %in% input$auto_escape_check_group) & 62 | is.null(safe_half_slashes(input$test_str)) 63 | ) 64 | }) 65 | 66 | pattern <- shiny::reactive({ 67 | req(input$pattern) 68 | 69 | pattern <- ifelse("pattern" %in% input$auto_escape_check_group, 70 | input$pattern, 71 | safe_half_slashes(input$pattern) 72 | ) 73 | 74 | pattern 75 | }) 76 | 77 | test_str <- shiny::reactive({ 78 | req(input$test_str) 79 | 80 | test_str <- ifelse("test_str" %in% input$auto_escape_check_group, 81 | input$test_str, 82 | safe_half_slashes(input$test_str) 83 | ) 84 | 85 | test_str 86 | }) 87 | 88 | match_list <- shiny::reactive({ 89 | req(pattern(), test_str(), !bad_slash()) 90 | 91 | ignore_case_log <- "ignore_case" %in% input$additional_params 92 | global_log <- "global" %in% input$additional_params 93 | perl_log <- "perl" %in% input$additional_params 94 | fixed_log <- "fixed" %in% input$additional_params 95 | 96 | safe_get_match_list( 97 | test_str(), pattern(), 98 | ignore_case_log, global_log, perl_log, fixed_log 99 | ) 100 | }) 101 | 102 | output$highlight_str <- shiny::renderUI({ 103 | ignore_case_log <- "ignore_case" %in% input$additional_params 104 | global_log <- "global" %in% input$additional_params 105 | perl_log <- "perl" %in% input$additional_params 106 | fixed_log <- "fixed" %in% input$additional_params 107 | 108 | out <- safe_highlight_test_str( 109 | test_str(), 110 | pattern(), 111 | ignore_case_log, 112 | global_log, 113 | perl_log, 114 | fixed_log 115 | ) 116 | 117 | out <- gsub("\n", "
", out) 118 | 119 | if (is.null(out)) { 120 | shiny::HTML("") 121 | } else { 122 | shiny::HTML( 123 | paste0( 124 | "Note: nested capture groups currently not ", 125 | "supported for in place highlighting

", out, "


" 127 | ) 128 | ) 129 | } 130 | }) 131 | 132 | output$match_list_html <- shiny::renderUI({ 133 | if (!bad_slash()) { 134 | out <- safe_html_format_match_list(match_list()) 135 | } else if (bad_slash()) { 136 | out <- paste0( 137 | "

Error with backslashes.

", 138 | "Remember to manually escape backslashes when ", 139 | "escape backslashes option isn't selected." 140 | ) 141 | } 142 | if (is.null(out)) { 143 | out <- HTML("

No matches found in Test String

") 144 | } else { 145 | out <- HTML(out) 146 | } 147 | 148 | shiny::wellPanel( 149 | out, 150 | style = "background-color: #ffffff; overflow-y:scroll; max-height: 500px" 151 | ) 152 | }) 153 | 154 | output$r_code_snippet <- render_code( 155 | build_r_snippet(session, input, pattern()) 156 | ) 157 | 158 | output$explaination_dt <- DT::renderDataTable({ 159 | if (bad_slash()) { 160 | out <- data.frame(ERROR = "there was an error retreiving explanation") 161 | } else if ("fixed" %in% input$additional_params) { 162 | out <- data.frame( 163 | `NA` = "explanations are not applicable when using Fixed option" 164 | ) 165 | } else { 166 | out <- safe_regexplain(pattern()) 167 | if (is.null(out)) { 168 | out <- data.frame( 169 | ERROR = "there was an error retreiving explanation" 170 | ) 171 | } 172 | } 173 | 174 | out 175 | }) 176 | } 177 | -------------------------------------------------------------------------------- /R/app_ui.R: -------------------------------------------------------------------------------- 1 | #' The application User-Interface 2 | #' 3 | #' @param request Internal parameter for `{shiny}`. 4 | #' DO NOT REMOVE. 5 | #' @import shiny 6 | #' @noRd 7 | app_ui <- function(request) { 8 | shiny::tagList( 9 | # Leave this function for adding external resources 10 | golem_add_external_resources(), 11 | # List the first level UI elements here 12 | shiny::navbarPage( 13 | title = "R Regex Tester", 14 | theme = shinythemes::shinytheme("cosmo"), 15 | shiny::tabPanel("Home", 16 | shiny::fluidRow( 17 | col_12( 18 | align = "left", 19 | shiny::sidebarLayout( 20 | shiny::sidebarPanel( 21 | style = "background-color: #ffffff;", 22 | shiny::HTML("

23 | Options 24 | 25 |

26 |
"), 27 | shiny::checkboxGroupInput( 28 | "auto_escape_check_group", 29 | label = shiny::HTML( 30 | "" 31 | ), 32 | choices = c( 33 | "Pattern" = "pattern", 34 | "Test String" = "test_str" 35 | ), 36 | selected = "test_str" 37 | ), # shiny::checkboxGroupInput 38 | shinyBS::bsPopover( 39 | id = "auto_escape_doc_popover", 40 | title = "Bring your own escapes?", 41 | content = paste0( 42 | "When working with regex in R, you often need more ", 43 | shiny::code("\\\\"), " than you think. For example, in Rs regex ", 44 | shiny::code("\\\\\\\\n"), " is a new line and ", shiny::code("\\\\n"), 45 | " is an ", shiny::code("n"), ". ", shiny::br(), shiny::br(), 46 | "When selected, this feature will force you to write regex with the number of ", 47 | "backslashes that R is looking for. This can lead to some unexpected behavior; ", 48 | "for example, a new line in the test string will be converted to the letter ", 49 | shiny::code("n"), " (because ", shiny::code("\\\\n"), " -> ", shiny::code("n"), ")." 50 | ), 51 | placement = "right", 52 | trigger = "hover", 53 | options = list(container = "body") 54 | ), # shinyBS::bsPopover 55 | shiny::checkboxGroupInput( 56 | "additional_params", 57 | label = shiny::tags$label("Additional Parameters"), 58 | choices = c( 59 | "Ignore Case" = "ignore_case", 60 | "Global" = "global", 61 | "Perl" = "perl", 62 | "Fixed (overrides Ignore Case & Perl)" = "fixed" 63 | ), 64 | selected = c("ignore_case", "global", "perl") 65 | ), # shiny::checkboxGroupInput 66 | shiny::br(), 67 | shiny::fluidRow( 68 | col_4( 69 | align = "center", 70 | shiny::HTML('
71 | 78 | Issue 79 | 80 | 81 |
') 82 | ), # col_4 83 | col_4( 84 | align = "center", 85 | shiny::HTML('
86 | 94 | Star 95 | 96 | 97 |
') 98 | ), # col_4 99 | col_4( 100 | align = "center", 101 | shiny::HTML("
102 | 109 | 119 |
") 120 | ) # col_4 121 | ), # fluidRow 122 | shiny::hr(), 123 | shiny::fluidRow( 124 | col_10( 125 | align = "center", 126 | offset = 1, 127 | shiny::actionButton( 128 | inputId = "about_app", 129 | "About", 130 | icon = shiny::icon("file-alt"), 131 | onclick = "window.open('https://adamspannbauer.github.io/2018/01/16/r-regex-tester-shiny-app/', '_blank')" 132 | ) 133 | ) 134 | ) # fluidRow 135 | ), # sidebarPanel 136 | shiny::mainPanel( 137 | shiny::fluidRow( 138 | col_12( 139 | align = "left", 140 | shiny::wellPanel( 141 | style = "background-color: #f2f2f2;", 142 | shiny::HTML("Input"), 143 | shiny::div( 144 | style = "display:inline-block; float:right", 145 | shiny::actionButton("save_button", "Save", icon = shiny::icon("save")) 146 | ), 147 | shiny::hr(), 148 | shiny::textInput("pattern", 149 | label = "Matching Pattern", 150 | value = "t(es)(t)", 151 | placeholder = "Enter regex to match", 152 | width = "100%" 153 | ), 154 | shiny::textAreaInput("test_str", 155 | label = HTML("Test String (HTML tags are not supported)"), 156 | value = "This is a test string for testing regex.", 157 | placeholder = "Enter string to match regex against", 158 | width = "100%" 159 | ) 160 | ), # wellPanel 161 | shinyBS::bsCollapse( 162 | id = "explanation_collapse", 163 | shinyBS::bsCollapsePanel( 164 | shiny::HTML("Reg-Explanation"), 165 | shiny::HTML('explanation provided by rick.measham.id.au
'), 166 | DT::dataTableOutput("explaination_dt"), 167 | style = "default" 168 | ) # bsCollapsePanel 169 | ), # bsCollapse 170 | shinyBS::bsCollapse( 171 | id = "r_snippet_collapse", 172 | shinyBS::bsCollapsePanel( 173 | shiny::HTML("R Code Snippets"), 174 | code_output("r_code_snippet"), 175 | style = "default" 176 | ) # bsCollapsePanel 177 | ), # bsCollapse 178 | shiny::wellPanel( 179 | style = "background-color: #f2f2f2;", 180 | shiny::HTML("Results
"), 181 | shiny::uiOutput("highlight_str"), 182 | shiny::uiOutput("match_list_html") 183 | ) # wellPanel 184 | ) # col_12 185 | ) # fluidRow 186 | ) # mainPanel 187 | ) # sidebarLayout 188 | ) # col_12 189 | ), # fluidRow 190 | rep_br(3), 191 | shiny::hr(), 192 | shiny::fluidRow( 193 | col_12( 194 | align = "center", 195 | shiny::HTML( 196 | paste0( 197 | "

When in Doubt

", 198 | " ", 200 | "
image source xkcd
" 201 | ) 202 | ) # HTML 203 | ) # col_12 204 | ), # fluidRow 205 | icon = shiny::icon("home") 206 | ), # tabPanel 207 | shiny::tabPanel( 208 | "RStudio Regex Cheatsheet", 209 | shiny::fluidRow( 210 | col_12( 211 | align = "center", 212 | shiny::HTML('') 213 | ) # col_12 214 | ) # fluidRow 215 | ), # tabPanel 216 | shiny::tabPanel( 217 | HTML("?regex"), 218 | shiny::includeHTML( 219 | app_sys("app/www/regex_documentation.html") 220 | ) 221 | ) # tabPanel 222 | ) # navbarPage 223 | ) # tagList 224 | } 225 | 226 | #' Add external Resources to the Application 227 | #' 228 | #' This function is internally used to add external 229 | #' resources inside the Shiny application. 230 | #' 231 | #' @import shiny 232 | #' @importFrom golem add_resource_path activate_js favicon bundle_resources 233 | #' @noRd 234 | golem_add_external_resources <- function() { 235 | golem::add_resource_path( 236 | "www", app_sys("app/www") 237 | ) 238 | 239 | shiny::tags$head( 240 | shiny::includeHTML(app_sys("app/www/ga_tag.html")), 241 | shiny::tags$script( 242 | " 243 | function copySaveUrlToClipboard() { 244 | let range = document.createRange(); 245 | let selection = window.getSelection(); 246 | let urlElement = document.querySelector('#save_url_copy'); 247 | 248 | range.selectNodeContents(urlElement); 249 | 250 | selection.removeAllRanges(); 251 | selection.addRange(range); 252 | 253 | document.execCommand('copy'); 254 | } 255 | " 256 | ), 257 | golem::favicon(ext = "png"), 258 | golem::bundle_resources( 259 | path = app_sys("app/www"), 260 | app_title = "R Regex Tester" 261 | ) 262 | ) 263 | } 264 | -------------------------------------------------------------------------------- /R/build_r_snippet.R: -------------------------------------------------------------------------------- 1 | build_r_snippet <- function(session, input, pattern) { 2 | args <- c( 3 | "x = input" 4 | ) 5 | 6 | if ("global" %in% input$additional_params) { 7 | sub_func <- "gsub" 8 | gexpr_func <- "gregexpr" 9 | } else { 10 | sub_func <- "sub" 11 | gexpr_func <- "regexpr" 12 | } 13 | 14 | if ("ignore_case" %in% input$additional_params) { 15 | args <- c(args, "ignore.case = TRUE") 16 | } 17 | 18 | if ("perl" %in% input$additional_params) { 19 | args <- c(args, "perl = TRUE") 20 | } 21 | 22 | if ("fixed" %in% input$additional_params) { 23 | args <- c(args, "fixed = TRUE") 24 | } 25 | 26 | sub_args_str <- paste(c( 27 | "pattern = pattern", 28 | "replacement = replacement", 29 | args 30 | ), collapse = ",\n ") 31 | 32 | grep_args_str <- paste(c( 33 | "pattern = pattern", 34 | args 35 | ), collapse = ",\n ") 36 | 37 | snippet <- sprintf( 38 | "pattern = '%s' 39 | 40 | # A character vector to search for pattern in 41 | input = '' 42 | 43 | # If doing substitution, instances of the pattern 44 | # that are found will be replaced with this: 45 | replacement = '' 46 | 47 | # Find pattern and replace it 48 | replaced = %s( 49 | %s 50 | ) 51 | 52 | # Find locations of matches in a vector 53 | match_positions = grep( 54 | %s 55 | ) 56 | 57 | # Find positional info of matches and capture groups 58 | # (gets start index in string and match.length) 59 | match_info_list = %s( 60 | %s 61 | ) 62 | ", 63 | double_slashes(pattern), 64 | sub_func, sub_args_str, 65 | grep_args_str, 66 | gexpr_func, grep_args_str 67 | ) 68 | 69 | return(snippet) 70 | } 71 | -------------------------------------------------------------------------------- /R/build_save_url.R: -------------------------------------------------------------------------------- 1 | build_save_url <- function(session, input) { 2 | encoded_pattern <- paste0("pattern=", URLencode(input$pattern)) 3 | encoded_test_str <- paste0("test_str=", URLencode(input$test_str)) 4 | 5 | param_strs <- c(encoded_pattern, encoded_test_str) 6 | 7 | # Only append remaining parameters if they differ from the defaults 8 | # ----------------------- 9 | if ("pattern" %in% input$auto_escape_check_group) { 10 | param_strs <- c(param_strs, "aeb_pattern=TRUE") 11 | } 12 | 13 | if (!("test_str" %in% input$auto_escape_check_group)) { 14 | param_strs <- c(param_strs, "aeb_test_str=FALSE") 15 | } 16 | 17 | if (!("ignore_case" %in% input$additional_params)) { 18 | param_strs <- c(param_strs, "ignore_case=FALSE") 19 | } 20 | 21 | if (!("global" %in% input$additional_params)) { 22 | param_strs <- c(param_strs, "global=FALSE") 23 | } 24 | 25 | if (!("perl" %in% input$additional_params)) { 26 | param_strs <- c(param_strs, "perl=FALSE") 27 | } 28 | 29 | if ("fixed" %in% input$additional_params) { 30 | param_strs <- c(param_strs, "fixed=TRUE") 31 | } 32 | 33 | query_string <- paste0("?", paste(param_strs, collapse = "&")) 34 | 35 | shiny::updateQueryString(query_string, mode = "replace") 36 | 37 | port <- session$clientData$url_port 38 | port <- if (shiny::isTruthy(port)) paste0(":", port) else "" 39 | 40 | full_url <- paste0( 41 | session$clientData$url_hostname, 42 | port, 43 | session$clientData$url_pathname, 44 | query_string 45 | ) 46 | 47 | return(full_url) 48 | } 49 | -------------------------------------------------------------------------------- /R/get_match_list.R: -------------------------------------------------------------------------------- 1 | get_match_list <- function(str, pattern, ignore_case = TRUE, 2 | global = TRUE, perl = TRUE, fixed = FALSE) { 3 | #' Return list of pattern matches and captured text 4 | #' 5 | #' @param str string to apply regex to 6 | #' @param pattern regex to search for in str 7 | #' @param ignore_case see ?gsub 8 | #' @param global see ?gsub 9 | #' @param perl see ?gsub 10 | #' @param fixed see ?gsub 11 | #' 12 | #' @return a list with names as matched text and elements as 13 | #' character vectors of matched text 14 | #' @keywords internal 15 | #' @noRd 16 | #' @importFrom data.table := 17 | 18 | # Satisfy global variable check issues w/o globalVariables 19 | # These are col names used in NSE data.table expressions 20 | match_ind <- NULL 21 | starts <- NULL 22 | ends <- NULL 23 | capture_text <- NULL 24 | 25 | if (global) { 26 | matches_raw <- gregexpr(pattern, 27 | str, 28 | fixed = fixed, 29 | perl = perl & !fixed, 30 | ignore.case = ignore_case & !fixed 31 | )[[1]] 32 | 33 | if (all(matches_raw == -1)) { 34 | return(NULL) 35 | } 36 | 37 | matches <- regmatches( 38 | rep(str, length(matches_raw)), 39 | matches_raw 40 | ) 41 | } else { 42 | matches_raw <- regexpr(pattern, 43 | str, 44 | fixed = fixed, 45 | perl = perl & !fixed, 46 | ignore.case = ignore_case & !fixed 47 | ) 48 | 49 | matches <- regmatches(str, matches_raw)[[1]] 50 | } 51 | 52 | if (perl & !is.null(attr(matches_raw, "capture.start"))) { 53 | capture_start <- attr(matches_raw, "capture.start") 54 | capture_length <- attr(matches_raw, "capture.length") - 1 55 | capture_end <- capture_start + capture_length 56 | 57 | match_df <- data.table::data.table( 58 | match_ind = c(seq_len(length(matches))), 59 | match = matches, 60 | starts = as.numeric(capture_start), 61 | ends = as.numeric(capture_end) 62 | ) 63 | match_df <- match_df[order(match_ind, starts), ] 64 | match_df[, capture_text := stringr::str_sub(str, starts, ends)] 65 | 66 | match_list <- split( 67 | match_df$capture_text, 68 | paste0(match_df$match_ind, "_", match_df$match) 69 | ) 70 | 71 | names(match_list) <- gsub("^\\d+_", "", names(match_list)) 72 | } else { 73 | match_list <- lapply(seq_len(length(matches)), function(x) character(0)) 74 | names(match_list) <- matches 75 | } 76 | 77 | return(match_list) 78 | } 79 | -------------------------------------------------------------------------------- /R/golem_utils_ui.R: -------------------------------------------------------------------------------- 1 | #' Repeat tags$br 2 | #' 3 | #' @param times the number of br to return 4 | #' 5 | #' @return the number of br specified in times 6 | #' @noRd 7 | #' 8 | #' @importFrom htmltools HTML 9 | rep_br <- function(times = 1) { 10 | HTML(rep("
", times = times)) 11 | } 12 | 13 | 14 | #' Columns wrappers 15 | #' 16 | #' These are convenient wrappers around 17 | #' `column(12, ...)`, `column(6, ...)`, `column(4, ...)`... 18 | #' 19 | #' @noRd 20 | #' 21 | #' @importFrom shiny column 22 | col_12 <- function(...) { 23 | column(12, ...) 24 | } 25 | 26 | 27 | #' @importFrom shiny column 28 | #' @noRd 29 | col_10 <- function(...) { 30 | column(10, ...) 31 | } 32 | 33 | 34 | #' @importFrom shiny column 35 | #' @noRd 36 | col_5 <- function(...) { 37 | column(5, ...) 38 | } 39 | 40 | 41 | #' @importFrom shiny column 42 | #' @noRd 43 | col_4 <- function(...) { 44 | column(4, ...) 45 | } 46 | -------------------------------------------------------------------------------- /R/highlight_r_code.R: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/statistikat/codeModules/blob/master/R/renderCode.R 2 | 3 | r_code_container <- function(...) { 4 | code <- shiny::HTML( 5 | as.character(shiny::tags$code(class = "language-r", ...)) 6 | ) 7 | shiny::div(shiny::pre(code)) 8 | } 9 | 10 | inject_highlight_handler <- function() { 11 | code <- " 12 | Shiny.addCustomMessageHandler( 13 | 'highlight-code', 14 | function(message) { 15 | var id = message['id']; 16 | var delay = message['delay']; 17 | setTimeout( 18 | function() { 19 | var el = document.getElementById(id); 20 | hljs.highlightBlock(el); 21 | }, 22 | delay 23 | ); 24 | } 25 | );" 26 | tags$script(code) 27 | } 28 | 29 | include_highlight_js <- function() { 30 | resources <- system.file("www/shared/highlight", package = "shiny") 31 | shiny::singleton(list( 32 | shiny::includeScript(file.path(resources, "highlight.pack.js")), 33 | shiny::includeCSS(file.path(resources, "rstudio.css")), 34 | inject_highlight_handler() 35 | )) 36 | } 37 | 38 | render_code <- function(expr, env = parent.frame(), quoted = FALSE, 39 | output_args = list(), delay = 100) { 40 | func <- shiny::exprToFunction(expr, env, quoted) 41 | render_func <- function(shinysession, name, ...) { 42 | value <- func() 43 | for (d in delay) { 44 | shinysession$sendCustomMessage( 45 | "highlight-code", 46 | list(id = name, delay = d) 47 | ) 48 | } 49 | return(paste(utils::capture.output(cat(value)), collapse = "\n")) 50 | } 51 | shiny::markRenderFunction(code_output, render_func, outputArgs = output_args) 52 | } 53 | 54 | code_output <- function(output_id) { 55 | shiny::tagList( 56 | include_highlight_js(), 57 | shiny::uiOutput(output_id, container = r_code_container) 58 | ) 59 | } 60 | -------------------------------------------------------------------------------- /R/highlight_test_str.R: -------------------------------------------------------------------------------- 1 | highlight_test_str <- function(str, pattern, ignore_case = TRUE, 2 | global = TRUE, perl = TRUE, fixed = FALSE, 3 | color_palette = "Set3") { 4 | #' Highlight regex matches in output display with HTML 5 | #' 6 | #' @param str string to find matches in 7 | #' @param pattern pattern to match in str 8 | #' @param ignore_case see ?gsub 9 | #' @param global see ?gsub 10 | #' @param perl see ?gsub 11 | #' @param fixed see ?gsub 12 | #' @param color_palette RColorBrewer palette name for highlighting colors 13 | #' 14 | #' @return HTML string to be rendered with shiny::HTML() 15 | #' @keywords internal 16 | #' @noRd 17 | #' @importFrom data.table := .SD 18 | 19 | # Satisfy global variable check issues w/o globalVariables 20 | # These are col names used in NSE data.table expressions 21 | match_start <- NULL 22 | match_ind <- NULL 23 | capture_text <- NULL 24 | capture_ind <- NULL 25 | in_match_cap_start <- NULL 26 | in_match_cap_end <- NULL 27 | replacements <- NULL 28 | 29 | suppressWarnings({ 30 | colors <- RColorBrewer::brewer.pal(100, color_palette) 31 | }) 32 | 33 | if (global) { 34 | matches_raw <- gregexpr(pattern, 35 | str, 36 | fixed = fixed, 37 | perl = perl & !fixed, 38 | ignore.case = ignore_case & !fixed 39 | )[[1]] 40 | 41 | if (all(matches_raw == -1)) { 42 | return(NULL) 43 | } 44 | 45 | matches <- regmatches( 46 | rep(str, length(matches_raw)), 47 | matches_raw 48 | ) 49 | } else { 50 | matches_raw <- regexpr(pattern, 51 | str, 52 | fixed = fixed, 53 | perl = perl & !fixed, 54 | ignore.case = ignore_case & !fixed 55 | ) 56 | 57 | if (all(matches_raw == -1)) { 58 | return(NULL) 59 | } 60 | 61 | matches <- regmatches(str, matches_raw)[[1]] 62 | } 63 | 64 | if (perl & !is.null(attr(matches_raw, "capture.start"))) { 65 | match_end <- matches_raw + attr(matches_raw, "match.length") - 1 66 | capture_start <- attr(matches_raw, "capture.start") 67 | capture_length <- attr(matches_raw, "capture.length") - 1 68 | capture_end <- capture_start + capture_length 69 | 70 | match_df <- data.table::data.table( 71 | match_ind = c(seq_len(length(matches))), 72 | match = matches, 73 | match_start = rep(matches_raw, ncol(capture_end)), 74 | match_end = rep(match_end, ncol(capture_end)), 75 | capture_ind = rep(seq_len(ncol(capture_end)), each = nrow(capture_end)), 76 | capture_start = as.numeric(capture_start), 77 | capture_end = as.numeric(capture_end) 78 | ) 79 | 80 | match_df <- match_df[order(match_ind, capture_start), ] 81 | match_df[, capture_text := stringr::str_sub( 82 | str, capture_start, capture_end 83 | )] 84 | match_df[, in_match_cap_start := capture_start - (match_start - 1)] 85 | match_df[, in_match_cap_end := capture_end - (match_start - 1)] 86 | match_df <- unique( 87 | match_df[ 88 | , 89 | list( 90 | match, match_ind, match_start, match_end, 91 | capture_text, capture_ind, in_match_cap_start, 92 | in_match_cap_end 93 | ) 94 | ] 95 | ) 96 | match_df[, capture_text := paste0(capture_text, "_", capture_ind)] 97 | match_df <- match_df[, lapply( 98 | .SD, function(...) list(unique(...)) 99 | ), by = match] 100 | 101 | match_df$replacements <- vapply(seq_len(nrow(match_df)), function(.x) { 102 | txt <- match_df$match[.x] 103 | buffer <- 0 104 | for (i in seq_len(length(match_df$in_match_cap_start[[.x]]))) { 105 | cap_txt <- stringr::str_match( 106 | match_df$capture_text[[.x]][i], 107 | "(.+)_\\d+" 108 | )[, 2] 109 | 110 | if (match_df$in_match_cap_start[[.x]][i] + buffer <= nchar(txt) & 111 | match_df$in_match_cap_end[[.x]][i] + buffer <= nchar(txt)) { 112 | stringr::str_sub( 113 | txt, 114 | match_df$in_match_cap_start[[.x]][i] + buffer, 115 | match_df$in_match_cap_end[[.x]][i] + buffer 116 | ) <- "%s" 117 | replacement <- paste0( 118 | "", 119 | cap_txt, 120 | "" 121 | ) 122 | txt <- sprintf(txt, replacement) 123 | buffer <- buffer + nchar(replacement) - nchar(cap_txt) 124 | } 125 | } 126 | paste0( 127 | "", 128 | txt, 129 | "" 130 | ) 131 | }, character(1)) 132 | 133 | match_df <- tidyr::unnest(match_df[, list( 134 | match_ind, match, replacements, 135 | match_start, match_end 136 | )], 137 | cols = c(match_ind, match_start, match_end) 138 | ) 139 | match_df <- unique(match_df) 140 | 141 | # modifying string in place using indices 142 | # work back to front to avoid disrupting indices 143 | match_df <- data.table::data.table(match_df) 144 | match_df <- match_df[order(match_ind, decreasing = TRUE), ] 145 | } else { 146 | match_end <- matches_raw + attr(matches_raw, "match.length") - 1 147 | 148 | match_df <- data.table::data.table( 149 | match_ind = seq_len(length(matches)), 150 | match = matches, 151 | match_start = matches_raw, 152 | match_end = match_end 153 | ) 154 | match_df[, replacements := paste0( 155 | "", 156 | match, 157 | "" 158 | )] 159 | 160 | # modifying string in place using indices 161 | # work back to front to avoid disrupting indices 162 | match_df <- match_df[order(match_ind, decreasing = TRUE), ] 163 | } 164 | 165 | txt <- str 166 | for (i in seq_len(nrow(match_df))) { 167 | stringr::str_sub( 168 | txt, 169 | match_df$match_start[i], 170 | match_df$match_end[i] 171 | ) <- "%s" 172 | txt <- sprintf(txt, match_df$replacements[i]) 173 | } 174 | 175 | txt 176 | } 177 | -------------------------------------------------------------------------------- /R/html_format_match_list.R: -------------------------------------------------------------------------------- 1 | html_format_match_list = function(match_list, color_palette = "Set3") { 2 | #' Create HTML component to show list of items matched by pattern in test str 3 | #' 4 | #' @param match_list output of get_match_list() 5 | #' @param color_palette RColorBrewer palette name for highlighting colors 6 | #' 7 | #' @return HTML string to be rendered with shiny::HTML() 8 | #' @keywords internal 9 | #' @noRd 10 | 11 | suppressWarnings({ 12 | colors = RColorBrewer::brewer.pal(100, color_palette) 13 | }) 14 | 15 | match_text = paste0( 16 | "", 17 | stringr::str_replace_all(names(match_list), "\\s", " "), 18 | "%s" 19 | ) 20 | 21 | capture_text = vapply(match_list, function(x) { 22 | if (length(x) > 0) { 23 | x_colors = colors[2:(length(x) + 1)] 24 | list_elemes = paste0( 25 | "
  • ", 26 | stringr::str_replace_all(x, "\\s", " "), 27 | "
  • " 28 | ) 29 | collapsed_list_elems = paste(list_elemes, collapse = "
    ") 30 | paste("") 31 | } else { 32 | "" 33 | } 34 | }, character(1)) 35 | 36 | html_match_lists = purrr::map2_chr( 37 | match_text, capture_text, ~sprintf(.x, .y) 38 | ) 39 | collapsed_html_match_lists = paste0( 40 | html_match_lists, collapse = "
  • " 41 | ) 42 | 43 | paste0("

    Matched & Captured Text

    1. ", 44 | collapsed_html_match_lists, 45 | "
    ") 46 | } 47 | -------------------------------------------------------------------------------- /R/mgsub.R: -------------------------------------------------------------------------------- 1 | mgsub <- function(pattern, replacement, text.var, fixed = TRUE, ...) { 2 | #' Multi gsub 3 | #' 4 | #' @description I wanted qdap::mgsub() w/o having to have full qdap package. 5 | #' qdap has had issues related to deploying a shinyapp. So this 6 | #' is a trimmed down version of qdap::mgsub() 7 | #' 8 | #' @param pattern Character string to be matched in the given character 9 | #' vector. 10 | #' @param replacement Character string equal in length to pattern or of length 11 | #' one which are a replacement for matched pattern. 12 | #' @param text.var The text variable. 13 | #' @param fixed logical. If TRUE, pattern is a string to be matched as is. 14 | #' Overrides all conflicting arguments. 15 | #' @param ... Additional arguments passed to gsub. 16 | #' 17 | #' @return text.var with substitutions applied 18 | #' @keywords internal 19 | #' @noRd 20 | 21 | if (length(replacement) == 1) { 22 | replacement <- rep(replacement, length(pattern)) 23 | } 24 | 25 | for (i in seq_along(pattern)) { 26 | text.var <- gsub(pattern[i], replacement[i], text.var, fixed = fixed, ...) 27 | } 28 | 29 | text.var 30 | } 31 | -------------------------------------------------------------------------------- /R/parse_url_params.R: -------------------------------------------------------------------------------- 1 | parse_url_and_update_inputs <- function(session) { 2 | parsed <- shiny::parseQueryString(session$clientData$url_search) 3 | 4 | if ("pattern" %in% names(parsed)) { 5 | pattern <- URLdecode(parsed[["pattern"]]) 6 | shiny::updateTextInput(session, "pattern", value = pattern) 7 | } 8 | 9 | if ("test_str" %in% names(parsed)) { 10 | test_str <- URLdecode(parsed[["test_str"]]) 11 | shiny::updateTextAreaInput(session, "test_str", value = test_str) 12 | } 13 | 14 | # Update check boxes 15 | auto_escape_check_group <- character(0) 16 | additional_params <- character(0) 17 | 18 | if (shiny::isTruthy(parsed[["aeb_pattern"]] == "TRUE")) { 19 | auto_escape_check_group <- c(auto_escape_check_group, "pattern") 20 | } 21 | 22 | if (!shiny::isTruthy(parsed[["aeb_test_str"]] == "FALSE")) { 23 | auto_escape_check_group <- c(auto_escape_check_group, "test_str") 24 | } 25 | 26 | if (!shiny::isTruthy(parsed[["ignore_case"]] == "FALSE")) { 27 | additional_params <- c(additional_params, "ignore_case") 28 | } 29 | 30 | if (!shiny::isTruthy(parsed[["global"]] == "FALSE")) { 31 | additional_params <- c(additional_params, "global") 32 | } 33 | 34 | if (!shiny::isTruthy(parsed[["perl"]] == "FALSE")) { 35 | additional_params <- c(additional_params, "perl") 36 | } 37 | 38 | if (shiny::isTruthy(parsed[["fixed"]] == "TRUE")) { 39 | additional_params <- c(additional_params, "fixed") 40 | } 41 | 42 | shiny::updateCheckboxGroupInput( 43 | session, 44 | "auto_escape_check_group", 45 | selected = auto_escape_check_group 46 | ) 47 | 48 | shiny::updateCheckboxGroupInput( 49 | session, 50 | "additional_params", 51 | selected = additional_params 52 | ) 53 | } 54 | -------------------------------------------------------------------------------- /R/regexplain.R: -------------------------------------------------------------------------------- 1 | split_vec <- function(vec, splits) { 2 | #' Spit at a specified list of indices 3 | #' 4 | #' @param vec vector to split 5 | #' @param splits vector of split locations 6 | #' 7 | #' @return list of vectors 8 | #' @keywords internal 9 | #' @noRd 10 | 11 | split(vec, cumsum(seq_along(vec) %in% (splits))) 12 | } 13 | 14 | 15 | regexplain <- function(regx) { 16 | #' Create an 'explanation' of an inputted regular expression 17 | #' 18 | #' @details Provided by rick.measham.id.au 19 | #' 20 | #' @param regx string containing regular expression to explain 21 | #' 22 | #' @return a dataframe with columns c("regex", "explanation") 23 | #' @keywords internal 24 | #' @noRd 25 | 26 | base_url <- "http://rick.measham.id.au/paste/explain?regex=" 27 | 28 | regx_url <- stringr::str_replace_all( 29 | utils::URLencode(regx), stringr::fixed("+"), "%2B" 30 | ) 31 | regx_url <- stringr::str_replace_all( 32 | regx_url, stringr::fixed("[[:blank:]]"), "[:blank:]" 33 | ) 34 | regx_url <- stringr::str_replace_all( 35 | regx_url, stringr::fixed("[%5E[:blank:]]"), "[%5E:blank:]" 36 | ) 37 | 38 | full_url <- paste0(base_url, regx_url) 39 | 40 | page_html <- xml2::read_html(full_url) 41 | regexplain_tbl_txt <- rvest::html_text(rvest::html_node(page_html, "pre")) 42 | regexplain_tbl_txt <- stringr::str_split(trimws(regexplain_tbl_txt), "\n")[[1]] 43 | 44 | row_breaker <- "--------------------------------------------------------------------------------" 45 | 46 | regexplain_tbl_txt <- trimws( 47 | regexplain_tbl_txt[regexplain_tbl_txt != row_breaker] 48 | ) 49 | 50 | split_rows <- stringr::str_split(regexplain_tbl_txt, stringr::regex("\\s{2,}")) 51 | 52 | headers <- split_rows[[1]] 53 | rows <- split_rows[-1] 54 | 55 | good_inds <- which(vapply(rows, length, numeric(1)) != 1) 56 | 57 | clean_row_list <- lapply(split_vec(rows, good_inds), unlist) 58 | clean_row_list <- lapply(clean_row_list, function(x) { 59 | trimws(c(x[1], paste(x[-1], collapse = " "))) 60 | }) 61 | names(clean_row_list) <- paste0("node_", seq_along(clean_row_list)) 62 | 63 | explain_df <- data.table::as.data.table(do.call("rbind", clean_row_list)) 64 | data.table::setnames(explain_df, c("regex", "explanation")) 65 | 66 | if ( 67 | stringr::str_detect(regx, stringr::fixed("[[:blank:]]")) & 68 | any(stringr::str_detect(explain_df$regex, stringr::fixed("[:blank:]"))) 69 | ) { 70 | blank_inds <- which(explain_df$regex == "[:blank:]") 71 | explain_df$regex[blank_inds] <- "[[:blank:]]" 72 | explain_df$explanation[blank_inds] <- "any character of: blank characters (space and tab, and possibly other locale-dependent characters such as non-breaking space)" 73 | } 74 | 75 | if ( 76 | stringr::str_detect(regx, stringr::fixed("[^[:blank:]]")) & 77 | any(stringr::str_detect(explain_df$regex, stringr::fixed("[^:blank:]"))) 78 | ) { 79 | blank_inds <- which(explain_df$regex == "[^:blank:]") 80 | explain_df$regex[blank_inds] <- "[^[:blank:]]" 81 | explain_df$explanation[blank_inds] <- "any character except: blank characters (space and tab, and possibly other locale-dependent characters such as non-breaking space)" 82 | } 83 | 84 | explain_df 85 | } 86 | -------------------------------------------------------------------------------- /R/run_app.R: -------------------------------------------------------------------------------- 1 | #' Run the regexTestR 'Shiny' app 2 | #' 3 | #' @export 4 | #' @importFrom shiny shinyApp 5 | #' @importFrom golem with_golem_options 6 | run_app <- function() { 7 | with_golem_options( 8 | app = shinyApp( 9 | ui = app_ui, 10 | server = app_server 11 | ), 12 | golem_opts = list() 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /R/slash_utils.R: -------------------------------------------------------------------------------- 1 | half_slashes <- function(str, exclude = character(0)) { 2 | #' Given a string, remove half of the escaping backslashes 3 | #' 4 | #' @param str A string to remove backslashes from 5 | #' @param exclude A character vector of items to exclude from processing 6 | #' 7 | #' @return A version of the input string with half of the escaping chars 8 | #' @keywords internal 9 | #' @noRd 10 | #' @importFrom data.table := 11 | #' 12 | #' @details An exception will be thrown if removing slashes leads to a parsing 13 | #' error. For example, "\\" will be converted to "\" which is not 14 | #' a valid string. 15 | #' 16 | 17 | # Satisfy global variable check issues w/o globalVariables 18 | # These are col names used in NSE data.table expressions 19 | half_slash <- NULL 20 | slash_cap <- NULL 21 | out <- NULL 22 | char_cap <- NULL 23 | 24 | deparsed <- deparse(str) 25 | 26 | half_df <- data.table::as.data.table( 27 | stringr::str_match_all(deparsed, "(\\\\)(.)")[[1]] 28 | ) 29 | 30 | data.table::setnames(half_df, c("match", "slash_cap", "char_cap")) 31 | half_df[, half_slash := stringr::str_sub(slash_cap, 32 | end = (nchar(slash_cap) / 2) 33 | )] 34 | half_df[, out := paste0(half_slash, char_cap)] 35 | half_df <- unique(half_df[order(nchar(out)), ]) 36 | 37 | # Removing slashes before double quotes breaks eval 38 | half_df <- half_df[char_cap != '"'] 39 | 40 | # Dirty fix for new lines... 41 | for (x in exclude) { 42 | half_df[match == x, out := x] 43 | } 44 | 45 | halfed_deparse <- mgsub( 46 | half_df$match, 47 | half_df$out, 48 | deparsed 49 | ) 50 | 51 | eval(parse(text = halfed_deparse)) 52 | } 53 | 54 | 55 | double_slashes <- function(str) { 56 | #' Given a string, double the number of escaping backslashes 57 | #' 58 | #' @param str A string to double backslashes in 59 | #' @return A version of the input string with doubled escaping chars 60 | #' 61 | #' @keywords internal 62 | #' @noRd 63 | gsub("\\\\", "\\\\\\\\", str) 64 | } 65 | -------------------------------------------------------------------------------- /R/try_default.R: -------------------------------------------------------------------------------- 1 | try_default <- function(fun, default = NULL, silent = FALSE) { 2 | #' Create a 'safe' version of a function with a default return value 3 | #' 4 | #' @param fun function to add try logic to 5 | #' @param default default value to return if fun errors 6 | #' @param silent should error be printed to console? 7 | #' 8 | #' @return either output of fun or default value in case of error 9 | #' @keywords internal 10 | #' @noRd 11 | 12 | function(...) { 13 | out <- default 14 | try( 15 | { 16 | out <- fun(...) 17 | }, 18 | silent = silent 19 | ) 20 | 21 | return(out) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # R Regex Tester Shiny App 2 | 3 | [![Build Status](https://app.travis-ci.com/AdamSpannbauer/r_regex_tester_app.svg?branch=master)](https://app.travis-ci.com/github/AdamSpannbauer/r_regex_tester_app) [![Codecov test coverage](https://codecov.io/gh/AdamSpannbauer/r_regex_tester_app/branch/master/graph/badge.svg)](https://codecov.io/gh/AdamSpannbauer/r_regex_tester_app?branch=master) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/regexTestR)](https://CRAN.R-project.org/package=regexTestR) [![Last Commit](https://img.shields.io/github/last-commit/AdamSpannbauer/r_regex_tester_app.svg)](https://github.com/AdamSpannbauer/r_regex_tester_app/commits/master) ![](http://cranlogs.r-pkg.org/badges/grand-total/regexTestR) 4 | 5 |

    6 | 7 | 8 | 9 |

    10 | 11 | 12 | 13 | ## Usage 14 | 15 | ### Online 16 | 17 | * Visit the application live on [shinyapps.io](https://spannbaueradam.shinyapps.io/r_regex_tester/). 18 | 19 | ### Local 20 | 21 | * Install package 22 | 23 | ```r 24 | # Option 1: install from CRAN 25 | install.packages("regexTestR") 26 | 27 | # Option 2: install dev version from github 28 | devtools::install_github("AdamSpannbauer/r_regex_tester_app") 29 | ``` 30 | 31 | * Run app 32 | 33 | ```r 34 | regexTestR::run_app() 35 | ``` 36 | 37 | ## Features 38 | 39 | ### Options 40 | 41 | * Use the common options used across the R [Pattern Matching and Replacement](https://stat.ethz.ch/R-manual/R-devel/library/base/html/grep.html) family of functions. 42 | 43 |

    44 | 45 | 46 | 47 |

    48 | 49 | 50 | * The other 2 options concerning backslashes allow you to write an R flavored regex. 51 | * For example, if you want to match a literal period with a regex you'll type "\\\\." (as if you were writing the regex in R). 52 | * If you don't like this behavior, and you'd rather type half of the slashes needed to make the regex functional in R, you can select the "Auto Escape Backslashes" option for "Pattern" and then use "\\." to match literal periods in the app. 53 | 54 | ### Input 55 | 56 | * There are 2 text inputs: 57 | 1. __Matching Pattern__: type the regular expression or fixed pattern here that you want to use to match against your text. 58 | 2. __Test String__: type the text that you want your Matching Pattern to search through 59 | 60 |

    61 | 62 | 63 | 64 |

    65 | 66 | ### Results 67 | 68 | * After the pattern and test string are entered we see 2 different versions of the resulting pattern matching: 69 | 1. The test string is shown with the matches/capture groups highlighted where they appear in the text 70 | * As noted in the UI, currently nested capture group highlighting isn't supported. If our matching pattern was "t(e(s))(t)" the highlighting wouldn't display correctly. 71 | 2. The second output is a bulleted list of the matches and capture groups found in our test string. In the screen shot below we see we matched 2 instances of "test", and each of these matches display below them the contents of the 2 capture groups we included in our regex pattern. 72 | 73 |

    74 | 75 | 76 | 77 |

    78 | 79 | ### Regex Explanation 80 | 81 | * There's additionally a collapsable panel that will do it's best to break down your regex and explain the components. As noted in the UI these explanations are provided by [rick.measham.id.au](http://rick.measham.id.au/paste/explain) 82 | * The screen shot below shows the explanation for our regex: "t(es)(t)" 83 | 84 |

    85 | 86 | 87 | 88 |

    89 | 90 | ### Helping Documentation 91 | 92 |

    93 | 94 |

    95 | 96 | 97 | * The app includes some documentation for using regular expressions in R. The two including pieces of helping documentaion are: 98 | 1. The [RStudio](https://www.rstudio.com/) Regex Cheatsheet 99 | 2. The base R documentation on regex (this is what would appear if you ran the command `?regex`) 100 | 101 | ### Extra 102 | 103 | Shiny's bootstrap roots allow apps to transition between desktop and mobile pretty seamlessly. The app's mobile experience isn't terrible, so you can use it for all your regex-ing fun on the go! (I won't ask why) 104 | 105 |

    106 | 107 | 108 | 109 |

    110 | -------------------------------------------------------------------------------- /app.R: -------------------------------------------------------------------------------- 1 | # Launch the ShinyApp (Do not remove this comment) 2 | # To deploy, run: rsconnect::deployApp() 3 | # Or use the blue button on top of this file 4 | 5 | # Deploy to r_regex_tester_app for testing 6 | # Deploy to r_regex_tester for prod 7 | 8 | library(shinyBS) 9 | 10 | pkgload::load_all( 11 | export_all = FALSE, 12 | helpers = FALSE, 13 | attach_testthat = FALSE 14 | ) 15 | 16 | options("golem.app.prod" = TRUE) 17 | 18 | regexTestR::run_app() # add parameters here (if any) 19 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | 3 | * local R installation, R 4.1.1 (macOS Big Sur 11.6) 4 | * ubuntu 16.04 (on travis-ci; devel & release) 5 | * win-builder (devel, release, & old release) 6 | 7 | ## R CMD check results 8 | 9 | 0 errors | 0 warnings | 0 notes 10 | 11 | ## Notes about release 12 | 13 | * This is a minor release to fix a bug 14 | -------------------------------------------------------------------------------- /inst/app/www/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/inst/app/www/favicon.png -------------------------------------------------------------------------------- /inst/app/www/ga_tag.html: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /inst/app/www/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/inst/app/www/logo.png -------------------------------------------------------------------------------- /inst/app/www/regex_cheatsheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/inst/app/www/regex_cheatsheet.pdf -------------------------------------------------------------------------------- /inst/app/www/regex_documentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | R: Regular Expressions as used in R 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    regex {base}R Documentation
    14 |

    Regular Expressions as used in R

    15 | 16 |

    Description

    17 | 18 |

    This help page documents the regular expression patterns supported by 19 | grep and related functions grepl, regexpr, 20 | gregexpr, sub and gsub, as well as by 21 | strsplit. 22 |

    23 | 24 | 25 |

    Details

    26 | 27 |

    A ‘regular expression’ is a pattern that describes a set of 28 | strings. Two types of regular expressions are used in R, 29 | extended regular expressions (the default) and 30 | Perl-like regular expressions used by perl = TRUE. 31 | There is a also fixed = TRUE which can be considered to use a 32 | literal regular expression. 33 |

    34 |

    Other functions which use regular expressions (often via the use of 35 | grep) include apropos, browseEnv, 36 | help.search, list.files and ls. 37 | These will all use extended regular expressions. 38 |

    39 |

    Patterns are described here as they would be printed by cat: 40 | (do remember that backslashes need to be doubled when entering R 41 | character strings, e.g. from the keyboard). 42 |

    43 |

    Long regular expression patterns may or may not be accepted: the POSIX 44 | standard only requires up to 256 bytes. 45 |

    46 | 47 | 48 |

    Extended Regular Expressions

    49 | 50 |

    This section covers the regular expressions allowed in the default 51 | mode of grep, grep, regexpr, gregexpr, 52 | sub, gsub, regexec and strsplit. They use 53 | an implementation of the POSIX 1003.2 standard: that allows some scope 54 | for interpretation and the interpretations here are those currently 55 | used by R. The implementation supports some extensions to the 56 | standard. 57 |

    58 |

    Regular expressions are constructed analogously to arithmetic 59 | expressions, by using various operators to combine smaller 60 | expressions. The whole expression matches zero or more characters 61 | (read ‘character’ as ‘byte’ if useBytes = TRUE). 62 |

    63 |

    The fundamental building blocks are the regular expressions that match 64 | a single character. Most characters, including all letters and 65 | digits, are regular expressions that match themselves. Any 66 | metacharacter with special meaning may be quoted by preceding it with 67 | a backslash. The metacharacters in extended regular expressions are 68 | . \ | ( ) [ { ^ $ * + ?, but note that whether these have a 69 | special meaning depends on the context. 70 |

    71 |

    Escaping non-metacharacters with a backslash is 72 | implementation-dependent. The current implementation interprets 73 | \a as BEL, \e as ESC, \f as 74 | FF, \n as LF, \r as CR and 75 | \t as TAB. (Note that these will be interpreted by 76 | R's parser in literal character strings.) 77 |

    78 |

    A character class is a list of characters enclosed between 79 | [ and ] which matches any single character in that list; 80 | unless the first character of the list is the caret ^, when it 81 | matches any character not in the list. For example, the 82 | regular expression [0123456789] matches any single digit, and 83 | [^abc] matches anything except the characters a, 84 | b or c. A range of characters may be specified by 85 | giving the first and last characters, separated by a hyphen. (Because 86 | their interpretation is locale- and implementation-dependent, 87 | character ranges are best avoided.) The only portable way to specify 88 | all ASCII letters is to list them all as the character class
    [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz].
    (The 89 | current implementation uses numerical order of the encoding.) 90 |

    91 |

    Certain named classes of characters are predefined. Their 92 | interpretation depends on the locale (see locales); the 93 | interpretation below is that of the POSIX locale. 94 |

    95 | 96 |
    97 |
    [:alnum:]
    98 |
    99 |

    Alphanumeric characters: [:alpha:] 100 | and [:digit:].

    101 |
    102 |
    [:alpha:]
    103 |
    104 |

    Alphabetic characters: [:lower:] and 105 | [:upper:].

    106 |
    107 |
    [:blank:]
    108 |
    109 |

    Blank characters: space and tab, and 110 | possibly other locale-dependent characters such as non-breaking 111 | space.

    112 |
    113 |
    [:cntrl:]
    114 |
    115 |

    Control characters. In ASCII, these characters have octal codes 116 | 000 through 037, and 177 (DEL). In another character set, 117 | these are the equivalent characters, if any.

    118 |
    119 |
    [:digit:]
    120 |
    121 |

    Digits: 0 1 2 3 4 5 6 7 8 9.

    122 |
    123 |
    [:graph:]
    124 |
    125 |

    Graphical characters: [:alnum:] and 126 | [:punct:].

    127 |
    128 |
    [:lower:]
    129 |
    130 |

    Lower-case letters in the current locale.

    131 |
    132 |
    [:print:]
    133 |
    134 |

    Printable characters: [:alnum:], [:punct:] and space.

    135 |
    136 |
    [:punct:]
    137 |
    138 |

    Punctuation characters:
    ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~.

    139 |
    140 |
    141 |
    142 |
    [:space:]
    143 |
    144 |

    Space characters: tab, newline, vertical tab, form feed, carriage 145 | return, space and possibly other locale-dependent characters.

    146 |
    147 |
    [:upper:]
    148 |
    149 |

    Upper-case letters in the current locale.

    150 |
    151 |
    [:xdigit:]
    152 |
    153 |

    Hexadecimal digits:
    0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f.

    154 |
    155 |
    156 |

    For example, [[:alnum:]] means [0-9A-Za-z], except the 157 | latter depends upon the locale and the character encoding, whereas the 158 | former is independent of locale and character set. (Note that the 159 | brackets in these class names are part of the symbolic names, and must 160 | be included in addition to the brackets delimiting the bracket list.) 161 | Most metacharacters lose their special meaning inside a character 162 | class. To include a literal ], place it first in the list. 163 | Similarly, to include a literal ^, place it anywhere but first. 164 | Finally, to include a literal -, place it first or last (or, 165 | for perl = TRUE only, precede it by a backslash). (Only 166 | ^ - \ ] are special inside character classes.) 167 |

    168 |

    The period . matches any single character. The symbol 169 | \w matches a ‘word’ character (a synonym for 170 | [[:alnum:]_], an extension) and \W is its negation 171 | ([^[:alnum:]_]). Symbols \d, \s, \D 172 | and \S denote the digit and space classes and their negations 173 | (these are all extensions). 174 |

    175 |

    The caret ^ and the dollar sign $ are metacharacters 176 | that respectively match the empty string at the beginning and end of a 177 | line. The symbols \< and \> match the empty string at 178 | the beginning and end of a word. The symbol \b matches the 179 | empty string at either edge of a word, and \B matches the 180 | empty string provided it is not at an edge of a word. (The 181 | interpretation of ‘word’ depends on the locale and 182 | implementation: these are all extensions.) 183 |

    184 |

    A regular expression may be followed by one of several repetition 185 | quantifiers: 186 |

    187 | 188 |
    189 |
    ?
    190 |
    191 |

    The preceding item is optional and will be matched 192 | at most once.

    193 |
    194 |
    *
    195 |
    196 |

    The preceding item will be matched zero or more 197 | times.

    198 |
    199 |
    +
    200 |
    201 |

    The preceding item will be matched one or more 202 | times.

    203 |
    204 |
    {n}
    205 |
    206 |

    The preceding item is matched exactly n 207 | times.

    208 |
    209 |
    {n,}
    210 |
    211 |

    The preceding item is matched n or more 212 | times.

    213 |
    214 |
    {n,m}
    215 |
    216 |

    The preceding item is matched at least n 217 | times, but not more than m times.

    218 |
    219 |
    220 |

    By default repetition is greedy, so the maximal possible number of 221 | repeats is used. This can be changed to ‘minimal’ by appending 222 | ? to the quantifier. (There are further quantifiers that allow 223 | approximate matching: see the TRE documentation.) 224 |

    225 |

    Regular expressions may be concatenated; the resulting regular 226 | expression matches any string formed by concatenating the substrings 227 | that match the concatenated subexpressions. 228 |

    229 |

    Two regular expressions may be joined by the infix operator |; 230 | the resulting regular expression matches any string matching either 231 | subexpression. For example, abba|cde matches either the 232 | string abba or the string cde. Note that alternation 233 | does not work inside character classes, where | has its literal 234 | meaning. 235 |

    236 |

    Repetition takes precedence over concatenation, which in turn takes 237 | precedence over alternation. A whole subexpression may be enclosed in 238 | parentheses to override these precedence rules. 239 |

    240 |

    The backreference \N, where N = 1 ... 9, matches 241 | the substring previously matched by the Nth parenthesized 242 | subexpression of the regular expression. (This is an 243 | extension for extended regular expressions: POSIX defines them only 244 | for basic ones.) 245 |

    246 | 247 | 248 |

    Perl-like Regular Expressions

    249 | 250 |

    The perl = TRUE argument to grep, regexpr, 251 | gregexpr, sub, gsub and strsplit switches 252 | to the PCRE library that implements regular expression pattern 253 | matching using the same syntax and semantics as Perl 5.x, 254 | with just a few differences. 255 |

    256 |

    For complete details please consult the man pages for PCRE (and not 257 | PCRE2), especially man pcrepattern and man 258 | pcreapi), on your system or from the sources at 259 | http://www.pcre.org. (The version in use can be found by 260 | calling extSoftVersion. It need not be the version 261 | described in the system's man page. As PCRE has been feature-frozen 262 | for some time (essentially 2012), the man pages at 263 | http://www.pcre.org/original/doc/html/ should be a good match.) 264 |

    265 |

    Perl regular expressions can be computed byte-by-byte or 266 | (UTF-8) character-by-character: the latter is used in all multibyte 267 | locales and if any of the inputs are marked as UTF-8 (see 268 | Encoding). 269 |

    270 |

    All the regular expressions described for extended regular expressions 271 | are accepted except \< and \>: in Perl all backslashed 272 | metacharacters are alphanumeric and backslashed symbols always are 273 | interpreted as a literal character. { is not special if it 274 | would be the start of an invalid interval specification. There can be 275 | more than 9 backreferences (but the replacement in sub 276 | can only refer to the first 9). 277 |

    278 |

    Character ranges are interpreted in the numerical order of the 279 | characters, either as bytes in a single-byte locale or as Unicode code 280 | points in UTF-8 mode. So in either case [A-Za-z] specifies the 281 | set of ASCII letters. 282 |

    283 |

    In UTF-8 mode the named character classes only match ASCII characters: 284 | see \p below for an alternative. 285 |

    286 |

    The construct (?...) is used for Perl extensions in a variety 287 | of ways depending on what immediately follows the ?. 288 |

    289 |

    Perl-like matching can work in several modes, set by the options 290 | (?i) (caseless, equivalent to Perl's /i), (?m) 291 | (multiline, equivalent to Perl's /m), (?s) (single line, 292 | so a dot matches all characters, even new lines: equivalent to Perl's 293 | /s) and (?x) (extended, whitespace data characters are 294 | ignored unless escaped and comments are allowed: equivalent to Perl's 295 | /x). These can be concatenated, so for example, (?im) 296 | sets caseless multiline matching. It is also possible to unset these 297 | options by preceding the letter with a hyphen, and to combine setting 298 | and unsetting such as (?im-sx). These settings can be applied 299 | within patterns, and then apply to the remainder of the pattern. 300 | Additional options not in Perl include (?U) to set 301 | ‘ungreedy’ mode (so matching is minimal unless ? is used 302 | as part of the repetition quantifier, when it is greedy). Initially 303 | none of these options are set. 304 |

    305 |

    If you want to remove the special meaning from a sequence of 306 | characters, you can do so by putting them between \Q and 307 | \E. This is different from Perl in that $ and @ are 308 | handled as literals in \Q...\E sequences in PCRE, whereas in 309 | Perl, $ and @ cause variable interpolation. 310 |

    311 |

    The escape sequences \d, \s and \w represent 312 | any decimal digit, space character and ‘word’ character 313 | (letter, digit or underscore in the current locale: in UTF-8 mode only 314 | ASCII letters and digits are considered) respectively, and their 315 | upper-case versions represent their negation. Vertical tab was not 316 | regarded as a space character in a C locale before PCRE 8.34. 317 | Sequences \h, \v, \H and \V match 318 | horizontal and vertical space or the negation. (In UTF-8 mode, these 319 | do match non-ASCII Unicode code points.) 320 |

    321 |

    There are additional escape sequences: \cx is 322 | cntrl-x for any x, \ddd is the 323 | octal character (for up to three digits unless 324 | interpretable as a backreference, as \1 to \7 always 325 | are), and \xhh specifies a character by two hex digits. 326 | In a UTF-8 locale, \x{h...} specifies a Unicode code point 327 | by one or more hex digits. (Note that some of these will be 328 | interpreted by R's parser in literal character strings.) 329 |

    330 |

    Outside a character class, \A matches at the start of a 331 | subject (even in multiline mode, unlike ^), \Z matches 332 | at the end of a subject or before a newline at the end, \z 333 | matches only at end of a subject. and \G matches at first 334 | matching position in a subject (which is subtly different from Perl's 335 | end of the previous match). \C matches a single 336 | byte, including a newline, but its use is warned against. In UTF-8 337 | mode, \R matches any Unicode newline character (not just CR), 338 | and \X matches any number of Unicode characters that form an 339 | extended Unicode sequence. 340 |

    341 |

    In UTF-8 mode, some Unicode properties may be supported via 342 | \p{xx} and \P{xx} which match characters with and 343 | without property xx respectively. For a list of supported 344 | properties see the PCRE documentation, but for example Lu is 345 | ‘upper case letter’ and Sc is ‘currency symbol’. 346 | (This support depends on the PCRE library being compiled with 347 | ‘Unicode property support’ which can be checked via 348 | pcre_config.) 349 |

    350 |

    The sequence (?# marks the start of a comment which continues 351 | up to the next closing parenthesis. Nested parentheses are not 352 | permitted. The characters that make up a comment play no part at all in 353 | the pattern matching. 354 |

    355 |

    If the extended option is set, an unescaped # character outside 356 | a character class introduces a comment that continues up to the next 357 | newline character in the pattern. 358 |

    359 |

    The pattern (?:...) groups characters just as parentheses do 360 | but does not make a backreference. 361 |

    362 |

    Patterns (?=...) and (?!...) are zero-width positive and 363 | negative lookahead assertions: they match if an attempt to 364 | match the ... forward from the current position would succeed 365 | (or not), but use up no characters in the string being processed. 366 | Patterns (?<=...) and (?<!...) are the lookbehind 367 | equivalents: they do not allow repetition quantifiers nor \C 368 | in .... 369 |

    370 |

    regexpr and gregexpr support ‘named capture’. If 371 | groups are named, e.g., "(?<first>[A-Z][a-z]+)" then the 372 | positions of the matches are also returned by name. (Named 373 | backreferences are not supported by sub.) 374 |

    375 |

    Atomic grouping, possessive qualifiers and conditional 376 | and recursive patterns are not covered here. 377 |

    378 | 379 | 380 |

    Author(s)

    381 | 382 |

    This help page is based on the TRE documentation and the POSIX 383 | standard, and the pcrepattern man page from PCRE 8.36. 384 |

    385 | 386 | 387 |

    See Also

    388 | 389 |

    grep, apropos, browseEnv, 390 | glob2rx, help.search, list.files, 391 | ls and strsplit. 392 |

    393 |

    The TRE documentation at 394 | http://laurikari.net/tre/documentation/regex-syntax/). 395 |

    396 |

    The POSIX 1003.2 standard at 397 | http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html 398 |

    399 |

    The pcrepattern man page (found as part of 400 | http://www.pcre.org/original/pcre.txt), and details of Perl's own 401 | implementation at http://perldoc.perl.org/perlre.html. 402 |

    403 | 404 |
    405 |
    [Package base version 3.4.0 Index]
    406 | 407 | 408 | 409 | -------------------------------------------------------------------------------- /inst/golem-config.yml: -------------------------------------------------------------------------------- 1 | default: 2 | golem_name: regexTestR 3 | golem_version: 0.0.0.9000 4 | app_prod: no 5 | production: 6 | app_prod: yes 7 | dev: 8 | golem_wd: !expr here::here() 9 | -------------------------------------------------------------------------------- /man/run_app.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/run_app.R 3 | \name{run_app} 4 | \alias{run_app} 5 | \title{Run the regexTestR 'Shiny' app} 6 | \usage{ 7 | run_app() 8 | } 9 | \description{ 10 | Run the regexTestR 'Shiny' app 11 | } 12 | -------------------------------------------------------------------------------- /packrat/init.R: -------------------------------------------------------------------------------- 1 | local({ 2 | 3 | ## Helper function to get the path to the library directory for a 4 | ## given packrat project. 5 | getPackratLibDir <- function(projDir = NULL) { 6 | path <- file.path("packrat", "lib", R.version$platform, getRversion()) 7 | 8 | if (!is.null(projDir)) { 9 | 10 | ## Strip trailing slashes if necessary 11 | projDir <- sub("/+$", "", projDir) 12 | 13 | ## Only prepend path if different from current working dir 14 | if (!identical(normalizePath(projDir), normalizePath(getwd()))) 15 | path <- file.path(projDir, path) 16 | } 17 | 18 | path 19 | } 20 | 21 | ## Ensure that we set the packrat library directory relative to the 22 | ## project directory. Normally, this should be the working directory, 23 | ## but we also use '.rs.getProjectDirectory()' if necessary (e.g. we're 24 | ## rebuilding a project while within a separate directory) 25 | libDir <- if (exists(".rs.getProjectDirectory")) 26 | getPackratLibDir(.rs.getProjectDirectory()) 27 | else 28 | getPackratLibDir() 29 | 30 | ## Unload packrat in case it's loaded -- this ensures packrat _must_ be 31 | ## loaded from the private library. Note that `requireNamespace` will 32 | ## succeed if the package is already loaded, regardless of lib.loc! 33 | if ("packrat" %in% loadedNamespaces()) 34 | try(unloadNamespace("packrat"), silent = TRUE) 35 | 36 | if (suppressWarnings(requireNamespace("packrat", quietly = TRUE, lib.loc = libDir))) { 37 | 38 | # Check 'print.banner.on.startup' -- when NA and RStudio, don't print 39 | print.banner <- packrat::get_opts("print.banner.on.startup") 40 | if (print.banner == "auto" && is.na(Sys.getenv("RSTUDIO", unset = NA))) { 41 | print.banner <- TRUE 42 | } else { 43 | print.banner <- FALSE 44 | } 45 | return(packrat::on(print.banner = print.banner)) 46 | } 47 | 48 | ## Escape hatch to allow RStudio to handle bootstrapping. This 49 | ## enables RStudio to provide print output when automagically 50 | ## restoring a project from a bundle on load. 51 | if (!is.na(Sys.getenv("RSTUDIO", unset = NA)) && 52 | is.na(Sys.getenv("RSTUDIO_PACKRAT_BOOTSTRAP", unset = NA))) { 53 | Sys.setenv("RSTUDIO_PACKRAT_BOOTSTRAP" = "1") 54 | setHook("rstudio.sessionInit", function(...) { 55 | # Ensure that, on sourcing 'packrat/init.R', we are 56 | # within the project root directory 57 | if (exists(".rs.getProjectDirectory")) { 58 | owd <- getwd() 59 | setwd(.rs.getProjectDirectory()) 60 | on.exit(setwd(owd), add = TRUE) 61 | } 62 | source("packrat/init.R") 63 | }) 64 | return(invisible(NULL)) 65 | } 66 | 67 | ## Bootstrapping -- only performed in interactive contexts, 68 | ## or when explicitly asked for on the command line 69 | if (interactive() || "--bootstrap-packrat" %in% commandArgs(TRUE)) { 70 | 71 | needsRestore <- "--bootstrap-packrat" %in% commandArgs(TRUE) 72 | 73 | message("Packrat is not installed in the local library -- ", 74 | "attempting to bootstrap an installation...") 75 | 76 | ## We need utils for the following to succeed -- there are calls to functions 77 | ## in 'restore' that are contained within utils. utils gets loaded at the 78 | ## end of start-up anyhow, so this should be fine 79 | library("utils", character.only = TRUE) 80 | 81 | ## Install packrat into local project library 82 | packratSrcPath <- list.files(full.names = TRUE, 83 | file.path("packrat", "src", "packrat") 84 | ) 85 | 86 | ## No packrat tarballs available locally -- try some other means of installation 87 | if (!length(packratSrcPath)) { 88 | 89 | message("> No source tarball of packrat available locally") 90 | 91 | ## There are no packrat sources available -- try using a version of 92 | ## packrat installed in the user library to bootstrap 93 | if (requireNamespace("packrat", quietly = TRUE) && packageVersion("packrat") >= "0.2.0.99") { 94 | message("> Using user-library packrat (", 95 | packageVersion("packrat"), 96 | ") to bootstrap this project") 97 | } 98 | 99 | ## Couldn't find a user-local packrat -- try finding and using devtools 100 | ## to install 101 | else if (requireNamespace("devtools", quietly = TRUE)) { 102 | message("> Attempting to use devtools::install_github to install ", 103 | "a temporary version of packrat") 104 | library(stats) ## for setNames 105 | devtools::install_github("rstudio/packrat") 106 | } 107 | 108 | ## Try downloading packrat from CRAN if available 109 | else if ("packrat" %in% rownames(available.packages())) { 110 | message("> Installing packrat from CRAN") 111 | install.packages("packrat") 112 | } 113 | 114 | ## Fail -- couldn't find an appropriate means of installing packrat 115 | else { 116 | stop("Could not automatically bootstrap packrat -- try running ", 117 | "\"'install.packages('devtools'); devtools::install_github('rstudio/packrat')\"", 118 | "and restarting R to bootstrap packrat.") 119 | } 120 | 121 | # Restore the project, unload the temporary packrat, and load the private packrat 122 | if (needsRestore) 123 | packrat::restore(prompt = FALSE, restart = TRUE) 124 | 125 | ## This code path only reached if we didn't restart earlier 126 | unloadNamespace("packrat") 127 | requireNamespace("packrat", lib.loc = libDir, quietly = TRUE) 128 | return(packrat::on()) 129 | 130 | } 131 | 132 | ## Multiple packrat tarballs available locally -- try to choose one 133 | ## TODO: read lock file and infer most appropriate from there; low priority because 134 | ## after bootstrapping packrat a restore should do the right thing 135 | if (length(packratSrcPath) > 1) { 136 | warning("Multiple versions of packrat available in the source directory;", 137 | "using packrat source:\n- ", shQuote(packratSrcPath)) 138 | packratSrcPath <- packratSrcPath[[1]] 139 | } 140 | 141 | 142 | lib <- file.path("packrat", "lib", R.version$platform, getRversion()) 143 | if (!file.exists(lib)) { 144 | dir.create(lib, recursive = TRUE) 145 | } 146 | 147 | message("> Installing packrat into project private library:") 148 | message("- ", shQuote(lib)) 149 | 150 | surround <- function(x, with) { 151 | if (!length(x)) return(character()) 152 | paste0(with, x, with) 153 | } 154 | 155 | 156 | ## Invoke install.packages() in clean R session 157 | peq <- function(x, y) paste(x, y, sep = " = ") 158 | installArgs <- c( 159 | peq("pkgs", surround(packratSrcPath, with = "'")), 160 | peq("lib", surround(lib, with = "'")), 161 | peq("repos", "NULL"), 162 | peq("type", surround("source", with = "'")) 163 | ) 164 | 165 | fmt <- "utils::install.packages(%s)" 166 | installCmd <- sprintf(fmt, paste(installArgs, collapse = ", ")) 167 | 168 | ## Write script to file (avoid issues with command line quoting 169 | ## on R 3.4.3) 170 | installFile <- tempfile("packrat-bootstrap", fileext = ".R") 171 | writeLines(installCmd, con = installFile) 172 | on.exit(unlink(installFile), add = TRUE) 173 | 174 | fullCmd <- paste( 175 | surround(file.path(R.home("bin"), "R"), with = "\""), 176 | "--vanilla", 177 | "--slave", 178 | "-f", 179 | surround(installFile, with = "\"") 180 | ) 181 | system(fullCmd) 182 | 183 | ## Tag the installed packrat so we know it's managed by packrat 184 | ## TODO: should this be taking information from the lockfile? this is a bit awkward 185 | ## because we're taking an un-annotated packrat source tarball and simply assuming it's now 186 | ## an 'installed from source' version 187 | 188 | ## -- InstallAgent -- ## 189 | installAgent <- "InstallAgent: packrat 0.5.0" 190 | 191 | ## -- InstallSource -- ## 192 | installSource <- "InstallSource: source" 193 | 194 | packratDescPath <- file.path(lib, "packrat", "DESCRIPTION") 195 | DESCRIPTION <- readLines(packratDescPath) 196 | DESCRIPTION <- c(DESCRIPTION, installAgent, installSource) 197 | cat(DESCRIPTION, file = packratDescPath, sep = "\n") 198 | 199 | # Otherwise, continue on as normal 200 | message("> Attaching packrat") 201 | library("packrat", character.only = TRUE, lib.loc = lib) 202 | 203 | message("> Restoring library") 204 | if (needsRestore) 205 | packrat::restore(prompt = FALSE, restart = FALSE) 206 | 207 | # If the environment allows us to restart, do so with a call to restore 208 | restart <- getOption("restart") 209 | if (!is.null(restart)) { 210 | message("> Packrat bootstrap successfully completed. ", 211 | "Restarting R and entering packrat mode...") 212 | return(restart()) 213 | } 214 | 215 | # Callers (source-erers) can define this hidden variable to make sure we don't enter packrat mode 216 | # Primarily useful for testing 217 | if (!exists(".__DONT_ENTER_PACKRAT_MODE__.") && interactive()) { 218 | message("> Packrat bootstrap successfully completed. Entering packrat mode...") 219 | packrat::on() 220 | } 221 | 222 | Sys.unsetenv("RSTUDIO_PACKRAT_BOOTSTRAP") 223 | 224 | } 225 | 226 | }) 227 | -------------------------------------------------------------------------------- /packrat/packrat.lock: -------------------------------------------------------------------------------- 1 | PackratFormat: 1.4 2 | PackratVersion: 0.5.0 3 | RVersion: 4.0.0 4 | Repos: CRAN=https://cran.rstudio.com/ 5 | 6 | Package: BH 7 | Source: CRAN 8 | Version: 1.72.0-3 9 | Hash: fc53be86f0b712d3de03fef95893d710 10 | 11 | Package: DT 12 | Source: CRAN 13 | Version: 0.13 14 | Hash: f49c91ed6b763523e21e9a830cb6a2ca 15 | Requires: crosstalk, htmltools, htmlwidgets, jsonlite, magrittr, 16 | promises 17 | 18 | Package: R6 19 | Source: CRAN 20 | Version: 2.4.1 21 | Hash: b488861d8c3dfac497e041ec911df9fb 22 | 23 | Package: RColorBrewer 24 | Source: CRAN 25 | Version: 1.1-2 26 | Hash: c0d56cd15034f395874c870141870c25 27 | 28 | Package: Rcpp 29 | Source: CRAN 30 | Version: 1.0.4.6 31 | Hash: 8b95553bc32a59321b8981aa02bfbf72 32 | 33 | Package: askpass 34 | Source: CRAN 35 | Version: 1.1 36 | Hash: 6f6c430e3cd0dd7d48f447700f4d7e7f 37 | Requires: sys 38 | 39 | Package: assertthat 40 | Source: CRAN 41 | Version: 0.2.1 42 | Hash: 622be49032fe50bd42e96aaef613e209 43 | 44 | Package: attempt 45 | Source: CRAN 46 | Version: 0.3.1 47 | Hash: fc356e93cf7d37a15f935003228d49ad 48 | Requires: rlang 49 | 50 | Package: backports 51 | Source: CRAN 52 | Version: 1.1.7 53 | Hash: eac10bc96ef812453ce7f242aa67aafe 54 | 55 | Package: brew 56 | Source: CRAN 57 | Version: 1.0-6 58 | Hash: 931f9972deae0f205e1c78a51f33149b 59 | 60 | Package: callr 61 | Source: CRAN 62 | Version: 3.4.3 63 | Hash: e9b50bc56e655025fde6f2f4b65154de 64 | Requires: R6, processx 65 | 66 | Package: cli 67 | Source: CRAN 68 | Version: 2.0.2 69 | Hash: 6fc0b39f0fdbe3a025062807019e1180 70 | Requires: assertthat, crayon, fansi, glue 71 | 72 | Package: clipr 73 | Source: CRAN 74 | Version: 0.7.0 75 | Hash: 30cdec6c8cc62c80c485e6bdd0c02b05 76 | 77 | Package: commonmark 78 | Source: CRAN 79 | Version: 1.7 80 | Hash: 77f4ba718e2bad1877ef26e48cf8fa43 81 | 82 | Package: config 83 | Source: CRAN 84 | Version: 0.3 85 | Hash: 00b1a8d447124dc267d0bd36796b4024 86 | Requires: yaml 87 | 88 | Package: crayon 89 | Source: CRAN 90 | Version: 1.3.4 91 | Hash: ff2840dd9b0d563fc80377a5a45510cd 92 | 93 | Package: crosstalk 94 | Source: CRAN 95 | Version: 1.1.0.1 96 | Hash: 0074e4967b2db46d003c5d23e4519306 97 | Requires: R6, htmltools, jsonlite, lazyeval 98 | 99 | Package: curl 100 | Source: CRAN 101 | Version: 4.3 102 | Hash: 3916ae5637dbaf5996dbde80ea92a047 103 | 104 | Package: data.table 105 | Source: CRAN 106 | Version: 1.12.8 107 | Hash: 283ad0e503ab521300c6d1d02e58d2ae 108 | 109 | Package: desc 110 | Source: CRAN 111 | Version: 1.2.0 112 | Hash: a0a3ca939997679a52816bae4ed6aaae 113 | Requires: R6, assertthat, crayon, rprojroot 114 | 115 | Package: digest 116 | Source: CRAN 117 | Version: 0.6.25 118 | Hash: ec0a673866797c8c1fc1daa359fb4cad 119 | 120 | Package: dockerfiler 121 | Source: CRAN 122 | Version: 0.1.3 123 | Hash: 79d156c81cdb096bf9ad57c6d86991f8 124 | Requires: R6, attempt, glue 125 | 126 | Package: dplyr 127 | Source: CRAN 128 | Version: 1.0.0 129 | Hash: 4db17ac7cad6ce9c544dc8fc9709a75b 130 | Requires: R6, ellipsis, generics, glue, lifecycle, magrittr, rlang, 131 | tibble, tidyselect, vctrs 132 | 133 | Package: ellipsis 134 | Source: CRAN 135 | Version: 0.3.1 136 | Hash: b294fcc92985c6235df03c1c34f25e99 137 | Requires: rlang 138 | 139 | Package: evaluate 140 | Source: CRAN 141 | Version: 0.14 142 | Hash: 18306cc3bc1aec7b7360eea8a0eb0ee1 143 | 144 | Package: fansi 145 | Source: CRAN 146 | Version: 0.4.1 147 | Hash: fc0a252b8e427847d13e89f56ab4665e 148 | 149 | Package: fastmap 150 | Source: CRAN 151 | Version: 1.0.1 152 | Hash: d272cd728e4095b3964181b44763f46c 153 | 154 | Package: fs 155 | Source: CRAN 156 | Version: 1.4.1 157 | Hash: 6fc750e04d9d781e83d38c2f12958c80 158 | 159 | Package: generics 160 | Source: CRAN 161 | Version: 0.0.2 162 | Hash: 4aaf002dd434e8c854611c5d11a1d58e 163 | 164 | Package: gh 165 | Source: CRAN 166 | Version: 1.1.0 167 | Hash: efbe85b24e36b328003fd33772a8931b 168 | Requires: cli, httr, ini, jsonlite 169 | 170 | Package: git2r 171 | Source: CRAN 172 | Version: 0.27.1 173 | Hash: d0db6b4bcec242d9b2bd14e5f7e26f57 174 | 175 | Package: glue 176 | Source: CRAN 177 | Version: 1.4.1 178 | Hash: 740ccee1066d96aeb3f4d1e571245913 179 | 180 | Package: golem 181 | Source: CRAN 182 | Version: 0.2.1 183 | Hash: 29c7e68c0741238c1ec72718705e0be2 184 | Requires: attempt, cli, config, crayon, desc, dockerfiler, fs, here, 185 | htmltools, jsonlite, pkgload, remotes, rlang, roxygen2, rstudioapi, 186 | shiny, testthat, usethis, yaml 187 | 188 | Package: here 189 | Source: CRAN 190 | Version: 0.1 191 | Hash: 90e1a97508a0d7383b0eeb11e397e763 192 | Requires: rprojroot 193 | 194 | Package: highr 195 | Source: CRAN 196 | Version: 0.8 197 | Hash: 16aa2cc98d7b68c9d148c263c8dcdbcd 198 | 199 | Package: htmltools 200 | Source: CRAN 201 | Version: 0.4.0 202 | Hash: 140efd8a56fc8404e81f7ac44731ce47 203 | Requires: Rcpp, digest, rlang 204 | 205 | Package: htmlwidgets 206 | Source: CRAN 207 | Version: 1.5.1 208 | Hash: 20e5cc02b795afc7322836c947b5aab2 209 | Requires: htmltools, jsonlite, yaml 210 | 211 | Package: httpuv 212 | Source: CRAN 213 | Version: 1.5.3.1 214 | Hash: 75e5d24cbf270c6823ed2eda5f8e1212 215 | Requires: BH, R6, Rcpp, later, promises 216 | 217 | Package: httr 218 | Source: CRAN 219 | Version: 1.4.1 220 | Hash: cc16de93eaabd3c6d0785cb8e6d059ab 221 | Requires: R6, curl, jsonlite, mime, openssl 222 | 223 | Package: ini 224 | Source: CRAN 225 | Version: 0.3.1 226 | Hash: 9d6de5178c1cedabfb24e7d2acc9a092 227 | 228 | Package: jsonlite 229 | Source: CRAN 230 | Version: 1.6.1 231 | Hash: bfde5e6072ca0f5226f49e457a9ba62d 232 | 233 | Package: knitr 234 | Source: CRAN 235 | Version: 1.28 236 | Hash: 408899ff6416ccf790182c95c8fa9c81 237 | Requires: evaluate, highr, markdown, stringr, xfun, yaml 238 | 239 | Package: later 240 | Source: CRAN 241 | Version: 1.0.0 242 | Hash: 074cadbb9efd565454f7df6a2a56a672 243 | Requires: BH, Rcpp, rlang 244 | 245 | Package: lazyeval 246 | Source: CRAN 247 | Version: 0.2.2 248 | Hash: 563563691bea3cde6945a98996d7c166 249 | 250 | Package: lifecycle 251 | Source: CRAN 252 | Version: 0.2.0 253 | Hash: df8649860c43571aab68cc73a2a02807 254 | Requires: glue, rlang 255 | 256 | Package: magrittr 257 | Source: CRAN 258 | Version: 1.5 259 | Hash: bdc4d48c3135e8f3b399536ddf160df4 260 | 261 | Package: markdown 262 | Source: CRAN 263 | Version: 1.1 264 | Hash: 1b6a18fd395589425e338a47b999099f 265 | Requires: mime, xfun 266 | 267 | Package: mime 268 | Source: CRAN 269 | Version: 0.9 270 | Hash: f3388735b4ddea072aff3be44f7f4968 271 | 272 | Package: openssl 273 | Source: CRAN 274 | Version: 1.4.1 275 | Hash: b01fe6ae05ec2a30a777dc338af5bf69 276 | Requires: askpass 277 | 278 | Package: packrat 279 | Source: CRAN 280 | Version: 0.5.0 281 | Hash: 498643e765d1442ba7b1160a1df3abf9 282 | 283 | Package: pillar 284 | Source: CRAN 285 | Version: 1.4.4 286 | Hash: a49a235ae5deaefbb3f6053d67dc64d0 287 | Requires: cli, crayon, fansi, rlang, utf8, vctrs 288 | 289 | Package: pkgbuild 290 | Source: CRAN 291 | Version: 1.0.8 292 | Hash: 7f686e4c50ab63ae95537067d577de3f 293 | Requires: R6, callr, cli, crayon, desc, prettyunits, rprojroot, withr 294 | 295 | Package: pkgconfig 296 | Source: CRAN 297 | Version: 2.0.3 298 | Hash: 5ff5f2361851a49534c96caa2a8071c7 299 | 300 | Package: pkgload 301 | Source: CRAN 302 | Version: 1.0.2 303 | Hash: 41eb2db35be61f6f9e8864cf87a1ecb0 304 | Requires: desc, pkgbuild, rlang, rprojroot, rstudioapi, withr 305 | 306 | Package: praise 307 | Source: CRAN 308 | Version: 1.0.0 309 | Hash: 77da8f1df873a4b91e5c4a68fe2fb1b6 310 | 311 | Package: prettyunits 312 | Source: CRAN 313 | Version: 1.1.1 314 | Hash: 20669cd8bb8b3207f6371edf8cf510af 315 | 316 | Package: processx 317 | Source: CRAN 318 | Version: 3.4.2 319 | Hash: e1671b1ca2f6c66f29ffb2828e98dc02 320 | Requires: R6, ps 321 | 322 | Package: promises 323 | Source: CRAN 324 | Version: 1.1.0 325 | Hash: 3aad74d60d080359e7947b795cf53cf0 326 | Requires: R6, Rcpp, later, magrittr, rlang 327 | 328 | Package: ps 329 | Source: CRAN 330 | Version: 1.3.3 331 | Hash: 017cf9da2d29e4134b5e3e58176a87ad 332 | 333 | Package: purrr 334 | Source: CRAN 335 | Version: 0.3.4 336 | Hash: fb4c0edca61826ca0b5b33c828a7b276 337 | Requires: magrittr, rlang 338 | 339 | Package: rematch2 340 | Source: CRAN 341 | Version: 2.1.2 342 | Hash: b6823f74d6525d39d153620d21e206df 343 | Requires: tibble 344 | 345 | Package: remotes 346 | Source: CRAN 347 | Version: 2.1.1 348 | Hash: f579422000bd71d35602184ad3e2c641 349 | 350 | Package: rlang 351 | Source: CRAN 352 | Version: 0.4.6 353 | Hash: 961439fc46343c94eb50973664feee76 354 | 355 | Package: roxygen2 356 | Source: CRAN 357 | Version: 7.1.0 358 | Hash: 045f2c84a9128647eff3318c1dd72580 359 | Requires: R6, Rcpp, brew, commonmark, desc, digest, knitr, pkgload, 360 | purrr, rlang, stringi, stringr, xml2 361 | 362 | Package: rprojroot 363 | Source: CRAN 364 | Version: 1.3-2 365 | Hash: a25c3f70c166fb3fbabc410eb32b6366 366 | Requires: backports 367 | 368 | Package: rstudioapi 369 | Source: CRAN 370 | Version: 0.11 371 | Hash: f8674fe40760ccfc1bf3e92da4c9f4d0 372 | 373 | Package: rvest 374 | Source: CRAN 375 | Version: 0.3.5 376 | Hash: 76dc42671d747a857ea344bc56cd5b51 377 | Requires: httr, magrittr, selectr, xml2 378 | 379 | Package: selectr 380 | Source: CRAN 381 | Version: 0.4-2 382 | Hash: b915e37654e476cbad2ceb063a2b8edb 383 | Requires: R6, stringr 384 | 385 | Package: shiny 386 | Source: CRAN 387 | Version: 1.4.0.2 388 | Hash: 42d22fabaa1b11b7b7e4a9f623b4641a 389 | Requires: R6, crayon, digest, fastmap, htmltools, httpuv, jsonlite, 390 | later, mime, promises, rlang, sourcetools, xtable 391 | 392 | Package: shinyBS 393 | Source: CRAN 394 | Version: 0.61 395 | Hash: 4644935bd93e62a0b82686b26af7efc2 396 | Requires: htmltools, shiny 397 | 398 | Package: shinythemes 399 | Source: CRAN 400 | Version: 1.1.2 401 | Hash: b5eb2598708219fdfd4dcd65dae6d318 402 | Requires: shiny 403 | 404 | Package: sourcetools 405 | Source: CRAN 406 | Version: 0.1.7 407 | Hash: d093478ac90064e670cd4bf1a99b47b6 408 | 409 | Package: stringi 410 | Source: CRAN 411 | Version: 1.4.6 412 | Hash: 076b0f115b37ca6d551ccff96b91114e 413 | 414 | Package: stringr 415 | Source: CRAN 416 | Version: 1.4.0 417 | Hash: 67da32dbb2a7a16f2ef124336358e54a 418 | Requires: glue, magrittr, stringi 419 | 420 | Package: sys 421 | Source: CRAN 422 | Version: 3.3 423 | Hash: d5a4afad9298f42aae77f6389713a066 424 | 425 | Package: testthat 426 | Source: CRAN 427 | Version: 2.3.2 428 | Hash: 5a3a20ddc31b2aa228dab6d29bd43948 429 | Requires: R6, cli, crayon, digest, ellipsis, evaluate, magrittr, 430 | pkgload, praise, rlang, withr 431 | 432 | Package: tibble 433 | Source: CRAN 434 | Version: 3.0.1 435 | Hash: 00d3817b8530e9ce9b465aeef293a011 436 | Requires: cli, crayon, ellipsis, fansi, lifecycle, magrittr, pillar, 437 | pkgconfig, rlang, vctrs 438 | 439 | Package: tidyr 440 | Source: CRAN 441 | Version: 1.1.0 442 | Hash: cf176364a60e0e1b2730b5c2421b64bb 443 | Requires: Rcpp, dplyr, ellipsis, glue, lifecycle, magrittr, purrr, 444 | rlang, stringi, tibble, tidyselect, vctrs 445 | 446 | Package: tidyselect 447 | Source: CRAN 448 | Version: 1.1.0 449 | Hash: 1c7cea9ea925b701a93f378ec7233ee1 450 | Requires: ellipsis, glue, purrr, rlang, vctrs 451 | 452 | Package: usethis 453 | Source: CRAN 454 | Version: 1.6.1 455 | Hash: 85e02e5196279d1915a3d0b1a8b8947a 456 | Requires: cli, clipr, crayon, curl, desc, fs, gh, git2r, glue, purrr, 457 | rematch2, rlang, rprojroot, rstudioapi, whisker, withr, yaml 458 | 459 | Package: utf8 460 | Source: CRAN 461 | Version: 1.1.4 462 | Hash: f3f97ce59092abc8ed3fd098a59e236c 463 | 464 | Package: vctrs 465 | Source: CRAN 466 | Version: 0.3.0 467 | Hash: bd31aa68718ec5d68c187cc9aed0703b 468 | Requires: digest, ellipsis, glue, rlang 469 | 470 | Package: whisker 471 | Source: CRAN 472 | Version: 0.4 473 | Hash: 5b1ec05cd96c1e0c6048bab49abee3aa 474 | 475 | Package: withr 476 | Source: CRAN 477 | Version: 2.2.0 478 | Hash: 709a3da4deef928ab299f4ff52caf66b 479 | 480 | Package: xfun 481 | Source: CRAN 482 | Version: 0.14 483 | Hash: 94efcd6f2de13260899dd7ea5211b368 484 | 485 | Package: xml2 486 | Source: CRAN 487 | Version: 1.3.2 488 | Hash: edbf29fd0ba88bfabf6b6a4c4db0982b 489 | 490 | Package: xtable 491 | Source: CRAN 492 | Version: 1.8-4 493 | Hash: dc0d47261b678d26032363bebd050540 494 | 495 | Package: yaml 496 | Source: CRAN 497 | Version: 2.2.1 498 | Hash: 424bc11cc358f23187feaa7978628196 499 | -------------------------------------------------------------------------------- /packrat/packrat.opts: -------------------------------------------------------------------------------- 1 | auto.snapshot: FALSE 2 | use.cache: FALSE 3 | print.banner.on.startup: auto 4 | vcs.ignore.lib: TRUE 5 | vcs.ignore.src: FALSE 6 | external.packages: 7 | local.repos: 8 | load.external.packages.on.startup: TRUE 9 | ignored.packages: 10 | ignored.directories: 11 | data 12 | inst 13 | quiet.package.installation: TRUE 14 | snapshot.recommended.packages: FALSE 15 | snapshot.fields: 16 | Imports 17 | Depends 18 | LinkingTo 19 | symlink.system.packages: TRUE 20 | -------------------------------------------------------------------------------- /packrat/src/BH/BH_1.72.0-3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/BH/BH_1.72.0-3.tar.gz -------------------------------------------------------------------------------- /packrat/src/DT/DT_0.13.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/DT/DT_0.13.tar.gz -------------------------------------------------------------------------------- /packrat/src/R6/R6_2.4.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/R6/R6_2.4.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/RColorBrewer/RColorBrewer_1.1-2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/RColorBrewer/RColorBrewer_1.1-2.tar.gz -------------------------------------------------------------------------------- /packrat/src/Rcpp/Rcpp_1.0.4.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/Rcpp/Rcpp_1.0.4.6.tar.gz -------------------------------------------------------------------------------- /packrat/src/askpass/askpass_1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/askpass/askpass_1.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/assertthat/assertthat_0.2.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/assertthat/assertthat_0.2.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/attempt/attempt_0.3.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/attempt/attempt_0.3.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/backports/backports_1.1.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/backports/backports_1.1.7.tar.gz -------------------------------------------------------------------------------- /packrat/src/brew/brew_1.0-6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/brew/brew_1.0-6.tar.gz -------------------------------------------------------------------------------- /packrat/src/callr/callr_3.4.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/callr/callr_3.4.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/cli/cli_2.0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/cli/cli_2.0.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/clipr/clipr_0.7.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/clipr/clipr_0.7.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/commonmark/commonmark_1.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/commonmark/commonmark_1.7.tar.gz -------------------------------------------------------------------------------- /packrat/src/config/config_0.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/config/config_0.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/crayon/crayon_1.3.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/crayon/crayon_1.3.4.tar.gz -------------------------------------------------------------------------------- /packrat/src/crosstalk/crosstalk_1.1.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/crosstalk/crosstalk_1.1.0.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/curl/curl_4.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/curl/curl_4.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/data.table/data.table_1.12.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/data.table/data.table_1.12.8.tar.gz -------------------------------------------------------------------------------- /packrat/src/desc/desc_1.2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/desc/desc_1.2.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/digest/digest_0.6.25.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/digest/digest_0.6.25.tar.gz -------------------------------------------------------------------------------- /packrat/src/dockerfiler/dockerfiler_0.1.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/dockerfiler/dockerfiler_0.1.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/dplyr/dplyr_1.0.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/dplyr/dplyr_1.0.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/ellipsis/ellipsis_0.3.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/ellipsis/ellipsis_0.3.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/evaluate/evaluate_0.14.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/evaluate/evaluate_0.14.tar.gz -------------------------------------------------------------------------------- /packrat/src/fansi/fansi_0.4.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/fansi/fansi_0.4.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/fastmap/fastmap_1.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/fastmap/fastmap_1.0.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/fs/fs_1.4.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/fs/fs_1.4.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/generics/generics_0.0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/generics/generics_0.0.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/gh/gh_1.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/gh/gh_1.1.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/git2r/git2r_0.27.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/git2r/git2r_0.27.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/glue/glue_1.4.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/glue/glue_1.4.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/golem/golem_0.2.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/golem/golem_0.2.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/here/here_0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/here/here_0.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/highr/highr_0.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/highr/highr_0.8.tar.gz -------------------------------------------------------------------------------- /packrat/src/htmltools/htmltools_0.4.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/htmltools/htmltools_0.4.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/htmlwidgets/htmlwidgets_1.5.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/htmlwidgets/htmlwidgets_1.5.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/httpuv/httpuv_1.5.3.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/httpuv/httpuv_1.5.3.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/httr/httr_1.4.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/httr/httr_1.4.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/ini/ini_0.3.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/ini/ini_0.3.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/jsonlite/jsonlite_1.6.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/jsonlite/jsonlite_1.6.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/knitr/knitr_1.28.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/knitr/knitr_1.28.tar.gz -------------------------------------------------------------------------------- /packrat/src/later/later_1.0.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/later/later_1.0.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/lazyeval/lazyeval_0.2.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/lazyeval/lazyeval_0.2.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/lifecycle/lifecycle_0.2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/lifecycle/lifecycle_0.2.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/magrittr/magrittr_1.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/magrittr/magrittr_1.5.tar.gz -------------------------------------------------------------------------------- /packrat/src/markdown/markdown_1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/markdown/markdown_1.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/mime/mime_0.9.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/mime/mime_0.9.tar.gz -------------------------------------------------------------------------------- /packrat/src/openssl/openssl_1.4.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/openssl/openssl_1.4.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/packrat/packrat_0.5.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/packrat/packrat_0.5.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/pillar/pillar_1.4.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/pillar/pillar_1.4.4.tar.gz -------------------------------------------------------------------------------- /packrat/src/pkgbuild/pkgbuild_1.0.8.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/pkgbuild/pkgbuild_1.0.8.tar.gz -------------------------------------------------------------------------------- /packrat/src/pkgconfig/pkgconfig_2.0.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/pkgconfig/pkgconfig_2.0.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/pkgload/pkgload_1.0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/pkgload/pkgload_1.0.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/praise/praise_1.0.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/praise/praise_1.0.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/prettyunits/prettyunits_1.1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/prettyunits/prettyunits_1.1.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/processx/processx_3.4.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/processx/processx_3.4.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/promises/promises_1.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/promises/promises_1.1.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/ps/ps_1.3.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/ps/ps_1.3.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/purrr/purrr_0.3.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/purrr/purrr_0.3.4.tar.gz -------------------------------------------------------------------------------- /packrat/src/rematch2/rematch2_2.1.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/rematch2/rematch2_2.1.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/remotes/remotes_2.1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/remotes/remotes_2.1.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/rlang/rlang_0.4.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/rlang/rlang_0.4.6.tar.gz -------------------------------------------------------------------------------- /packrat/src/roxygen2/roxygen2_7.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/roxygen2/roxygen2_7.1.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/rprojroot/rprojroot_1.3-2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/rprojroot/rprojroot_1.3-2.tar.gz -------------------------------------------------------------------------------- /packrat/src/rstudioapi/rstudioapi_0.11.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/rstudioapi/rstudioapi_0.11.tar.gz -------------------------------------------------------------------------------- /packrat/src/rvest/rvest_0.3.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/rvest/rvest_0.3.5.tar.gz -------------------------------------------------------------------------------- /packrat/src/selectr/selectr_0.4-2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/selectr/selectr_0.4-2.tar.gz -------------------------------------------------------------------------------- /packrat/src/shiny/shiny_1.4.0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/shiny/shiny_1.4.0.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/shinyBS/shinyBS_0.61.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/shinyBS/shinyBS_0.61.tar.gz -------------------------------------------------------------------------------- /packrat/src/shinythemes/shinythemes_1.1.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/shinythemes/shinythemes_1.1.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/sourcetools/sourcetools_0.1.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/sourcetools/sourcetools_0.1.7.tar.gz -------------------------------------------------------------------------------- /packrat/src/stringi/stringi_1.4.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/stringi/stringi_1.4.6.tar.gz -------------------------------------------------------------------------------- /packrat/src/stringr/stringr_1.4.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/stringr/stringr_1.4.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/sys/sys_3.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/sys/sys_3.3.tar.gz -------------------------------------------------------------------------------- /packrat/src/testthat/testthat_2.3.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/testthat/testthat_2.3.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/tibble/tibble_3.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/tibble/tibble_3.0.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/tidyr/tidyr_1.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/tidyr/tidyr_1.1.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/tidyselect/tidyselect_1.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/tidyselect/tidyselect_1.1.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/usethis/usethis_1.6.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/usethis/usethis_1.6.1.tar.gz -------------------------------------------------------------------------------- /packrat/src/utf8/utf8_1.1.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/utf8/utf8_1.1.4.tar.gz -------------------------------------------------------------------------------- /packrat/src/vctrs/vctrs_0.3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/vctrs/vctrs_0.3.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/whisker/whisker_0.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/whisker/whisker_0.4.tar.gz -------------------------------------------------------------------------------- /packrat/src/withr/withr_2.2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/withr/withr_2.2.0.tar.gz -------------------------------------------------------------------------------- /packrat/src/xfun/xfun_0.14.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/xfun/xfun_0.14.tar.gz -------------------------------------------------------------------------------- /packrat/src/xml2/xml2_1.3.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/xml2/xml2_1.3.2.tar.gz -------------------------------------------------------------------------------- /packrat/src/xtable/xtable_1.8-4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/xtable/xtable_1.8-4.tar.gz -------------------------------------------------------------------------------- /packrat/src/yaml/yaml_2.2.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/packrat/src/yaml/yaml_2.2.1.tar.gz -------------------------------------------------------------------------------- /r_regex_tester_app.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | -------------------------------------------------------------------------------- /readme/r_regex_app_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdamSpannbauer/r_regex_tester_app/01e024075ca04ebf5dc12e05d728c1b38e11e9f9/readme/r_regex_app_screenshot.png -------------------------------------------------------------------------------- /rsconnect/shinyapps.io/spannbaueradam/r_regex_tester.dcf: -------------------------------------------------------------------------------- 1 | name: r_regex_tester 2 | title: r_regex_tester 3 | username: 4 | account: spannbaueradam 5 | server: shinyapps.io 6 | hostUrl: https://api.shinyapps.io/v1 7 | appId: 168980 8 | bundleId: 5783943 9 | url: https://spannbaueradam.shinyapps.io/r_regex_tester/ 10 | when: 1649604985.41288 11 | lastSyncTime: 1649604985.41289 12 | asMultiple: FALSE 13 | asStatic: FALSE 14 | -------------------------------------------------------------------------------- /rsconnect/shinyapps.io/spannbaueradam/r_regex_tester_app.dcf: -------------------------------------------------------------------------------- 1 | name: r_regex_tester_app 2 | title: r_regex_tester_app 3 | username: 4 | account: spannbaueradam 5 | server: shinyapps.io 6 | hostUrl: https://api.shinyapps.io/v1 7 | appId: 5382006 8 | bundleId: 5783837 9 | url: https://spannbaueradam.shinyapps.io/r_regex_tester_app/ 10 | when: 1649601709.33513 11 | lastSyncTime: 1649601709.33515 12 | asMultiple: FALSE 13 | asStatic: FALSE 14 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(regexTestR) 3 | 4 | test_check("regexTestR") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-get_match_list.R: -------------------------------------------------------------------------------- 1 | context("get_match_list") 2 | 3 | 4 | test_that("get_match_list basic", { 5 | test_result <- regexTestR:::get_match_list("abc aaa", "a(..)") 6 | expected <- list("abc" = "bc", "aaa" = "aa") 7 | 8 | expect_equal(test_result, expected) 9 | }) 10 | 11 | 12 | test_that("get_match_list perl = FALSE", { 13 | test_result <- regexTestR:::get_match_list("abc aaa", "a(..)", perl = FALSE) 14 | expected <- list("abc" = character(0), "aaa" = character(0)) 15 | 16 | expect_equal(test_result, expected) 17 | }) 18 | 19 | 20 | test_that("get_match_list global = FALSE", { 21 | test_result <- regexTestR:::get_match_list("abc aaa", "a(..)", global = FALSE) 22 | expected <- list("abc" = "bc") 23 | 24 | expect_equal(test_result, expected) 25 | }) 26 | 27 | 28 | test_that("get_match_list no matches", { 29 | test_result <- regexTestR:::get_match_list("aaa", "abc") 30 | expect_null(test_result) 31 | }) 32 | -------------------------------------------------------------------------------- /tests/testthat/test-golem-recommended.R: -------------------------------------------------------------------------------- 1 | context("golem tests") 2 | 3 | library(golem) 4 | 5 | test_that("app ui", { 6 | ui <- app_ui() 7 | expect_shinytaglist(ui) 8 | }) 9 | 10 | test_that("app server", { 11 | server <- app_server 12 | expect_is(server, "function") 13 | }) 14 | 15 | # Configure this test to fit your need 16 | test_that( 17 | "app launches", 18 | { 19 | skip_on_cran() 20 | skip_on_travis() 21 | skip_on_appveyor() 22 | x <- processx::process$new( 23 | "R", 24 | c( 25 | "-e", 26 | "regexTestR::run_app()" 27 | ) 28 | ) 29 | Sys.sleep(5) 30 | expect_true(x$is_alive()) 31 | x$kill() 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /tests/testthat/test-half_slashes.R: -------------------------------------------------------------------------------- 1 | context("half_slashes") 2 | 3 | 4 | test_that("half_slashes basic", { 5 | n_reps <- sample(1:10, size = 1) 6 | 7 | test_str <- paste(rep("\\", 2 * n_reps), collapse = "") 8 | expected <- paste(rep("\\", n_reps), collapse = "") 9 | 10 | test_result <- regexTestR:::half_slashes(test_str) 11 | 12 | expect_equal(test_result, expected) 13 | }) 14 | 15 | 16 | test_that("half_slashes exclude", { 17 | test_str <- "\\\n\\\t" 18 | expected <- "\\n\\t" 19 | 20 | test_result <- regexTestR:::half_slashes(test_str, exclude = c("\\n", "\\t")) 21 | 22 | expect_equal(test_result, expected) 23 | }) 24 | -------------------------------------------------------------------------------- /tests/testthat/test-highlight_test_str.R: -------------------------------------------------------------------------------- 1 | context("highlight_test_str") 2 | 3 | 4 | test_that("highlight_test_str basic", { 5 | test_result <- regexTestR:::highlight_test_str("abc aaa", "a(..)") 6 | expected <- paste0( 7 | "a", 8 | "bc", 9 | " a", 10 | "aa" 11 | ) 12 | 13 | expect_equal(test_result, expected) 14 | }) 15 | 16 | 17 | test_that("welcome screen example", { 18 | test_result <- regexTestR:::highlight_test_str("This is a test string for testing regex.", "t(es)(t)") 19 | expected <- paste0( 20 | "This is a t", 21 | "es", 22 | "t", 23 | " string for t", 24 | "es", 25 | "ting regex." 26 | ) 27 | 28 | expect_equal(test_result, expected) 29 | }) 30 | 31 | 32 | test_that("highlight_test_str perl = FALSE", { 33 | test_result <- regexTestR:::highlight_test_str("abc aaa", "a(..)", perl = FALSE) 34 | expected <- paste0( 35 | "abc ", 36 | "aaa" 37 | ) 38 | 39 | expect_equal(test_result, expected) 40 | }) 41 | 42 | 43 | test_that("highlight_test_str global = FALSE", { 44 | test_result <- regexTestR:::highlight_test_str("abc aaa", "a(..)", global = FALSE) 45 | expected <- paste0( 46 | "a", 47 | "bc", 48 | " aaa" 49 | ) 50 | 51 | expect_equal(test_result, expected) 52 | }) 53 | 54 | 55 | test_that("highlight_test_str no matches", { 56 | test_result <- regexTestR:::highlight_test_str("aaa", "abc") 57 | expect_null(test_result) 58 | }) 59 | -------------------------------------------------------------------------------- /tests/testthat/test-html_format_match_list.R: -------------------------------------------------------------------------------- 1 | context("html_format_match_list") 2 | 3 | 4 | test_that("html_format_match_list basic", { 5 | match_list <- regexTestR:::get_match_list("abc aaa", "a(..)") 6 | test_result <- regexTestR:::html_format_match_list(match_list) 7 | 8 | expected <- paste0( 9 | "

    Matched & Captured Text

    ", 10 | "
      ", 11 | "
    1. ", 12 | "abc", 13 | "
        ", 14 | "
      • bc
      • ", 15 | "
      ", 16 | "
    2. ", 17 | "
      ", 18 | "
    3. ", 19 | "aaa", 20 | "
        ", 21 | "
      • aa
      • ", 22 | "
      ", 23 | "
    4. ", 24 | "
    " 25 | ) 26 | 27 | expect_equal(test_result, expected) 28 | }) 29 | 30 | 31 | test_that("html_format_match_list no capture", { 32 | match_list <- regexTestR:::get_match_list("a", "a") 33 | test_result <- regexTestR:::html_format_match_list(match_list) 34 | 35 | expected <- paste0( 36 | "

    Matched & Captured Text

    ", 37 | "
      ", 38 | "
    1. ", 39 | "a", 40 | "
    2. ", 41 | "
    " 42 | ) 43 | 44 | expect_equal(test_result, expected) 45 | }) 46 | -------------------------------------------------------------------------------- /tests/testthat/test-regexplain.R: -------------------------------------------------------------------------------- 1 | context("regexlpain") 2 | 3 | 4 | test_that("split_vec", { 5 | test_result <- regexTestR:::split_vec(1:10, c(2, 5, 8)) 6 | expected <- list( 7 | `0` = 1L, 8 | `1` = 2:4, 9 | `2` = 5:7, 10 | `3` = 8:10 11 | ) 12 | 13 | expect_equal(test_result, expected) 14 | }) 15 | 16 | 17 | test_that("regexlpain basic", { 18 | test_result <- regexTestR:::regexplain("[[:blank:]][^[:blank:]]\\s+") 19 | 20 | expected <- data.table::data.table( 21 | regex = c( 22 | "[[:blank:]]", 23 | "[^[:blank:]]", 24 | "\\s+" 25 | ), 26 | explanation = c( 27 | "any character of: blank characters (space and tab, and possibly other locale-dependent characters such as non-breaking space)", 28 | "any character except: blank characters (space and tab, and possibly other locale-dependent characters such as non-breaking space)", 29 | "whitespace (\\n, \\r, \\t, \\f, and \" \") (1 or more times (matching the most amount possible))" 30 | ) 31 | ) 32 | 33 | expect_equal(test_result, expected) 34 | }) 35 | -------------------------------------------------------------------------------- /tests/testthat/test-try_default.R: -------------------------------------------------------------------------------- 1 | context("try_default") 2 | 3 | 4 | test_that("try_default basic", { 5 | add <- function(a, b) a + b 6 | safe_add <- regexTestR:::try_default(add, default = NULL, silent = TRUE) 7 | 8 | x <- runif(1) 9 | y <- runif(1) 10 | 11 | expect_equal(add(x, y), safe_add(x, y)) 12 | expect_null(safe_add(1, "1")) 13 | }) 14 | 15 | 16 | test_that("try_default change default", { 17 | add <- function(a, b) a + b 18 | safe_add <- regexTestR:::try_default(add, default = FALSE, silent = TRUE) 19 | 20 | expect_false(safe_add(1, "1")) 21 | }) 22 | --------------------------------------------------------------------------------