Преглед изворни кода

Enable perl by default, output non-default options in comments

tags/v0.2.0
Garrick Aden-Buie пре 8 година
родитељ
комит
274d9cea12
2 измењених фајлова са 14 додато и 5 уклоњено
  1. +8
    -4
      NEWS.md
  2. +6
    -1
      R/regex_gadget.R

+ 8
- 4
NEWS.md Прегледај датотеку

@@ -1,12 +1,16 @@
## regexplain 0.1.x

### 0.1.6
## regexplain 0.2

* Added "Templates" button that opens a dialog to import regex patterns
(initially) sourced from <https://projects.lukehaas.me/regexhub>.
* Added "Introduction", "Try These Examples" and "Resources" tabs to
the standard gadget Help tab.
* Several bugfixes and tests were added around unicode character escaping within the gadget.
* Several bugfixes and tests were added around unicode character escaping within
the gadget.
* Enable `perl` mode by default in gadget (consistent with `stringr` and most
regexes in the wild, but not base R). Write out selected options as comments
when not consistent with base R when returning pattern from gadget.

## regexplain 0.1.x

### 0.1.5


+ 6
- 1
R/regex_gadget.R Прегледај датотеку

@@ -76,7 +76,7 @@ regex_gadget <- function(text = NULL,
HTML('<span style="color: #5cb85c;">Fixed/Literal</span>'),
HTML('<span style="color: #f0ad4e;">Perl Style</span>'),
HTML('<span style="color: #f0ad4e;">Use Bytes</span>')),
selected = c('text_break_lines')
selected = c('text_break_lines', 'perl')
)
),
tags$div(
@@ -675,6 +675,11 @@ regex_gadget <- function(text = NULL,
observeEvent(input$done, {
if (pattern() != "") {
pattern <- paste0('pattern <- "', escape_backslash(pattern()), '"')
if (any(c("perl", "fixed", "ignore.case", "useBytes") %in% input$regex_options)) {
options <- input$regex_options[input$regex_options != "text_break_lines"]
options <- paste0(options, "=TRUE", collapse = ", ")
pattern <- paste(pattern, "#", options)
}
if ("regexFn_replacement" %in% names(input) && replacement() != "") {
pattern <- paste0(
pattern, "\n",

Loading…
Откажи
Сачувај