Przeglądaj źródła

Fix nested groups calculation and add example to Readme

tags/v0.1.0
Garrick Aden-Buie 8 lat temu
rodzic
commit
65faa5f601
4 zmienionych plików z 18 dodań i 2 usunięć
  1. +2
    -2
      R/run_regex.R
  2. +8
    -0
      Readme.Rmd
  3. +8
    -0
      Readme.md
  4. BIN
      docs/view-nested.png

+ 2
- 2
R/run_regex.R Wyświetl plik

for (j in seq_len(nrow(inserts))) { for (j in seq_len(nrow(inserts))) {
if (inserts$i[j] == 0) next if (inserts$i[j] == 0) next
overlap <- filter( overlap <- filter(
inserts,
inserts[1:(j-1), ],
i != 0, i != 0,
start <= !!inserts$start[j] & end > !!inserts$end[j])
start <= !!inserts$start[j] & end >= !!inserts$end[j])
inserts[j, 'pad'] <- inserts$pad[j] + nrow(overlap) inserts[j, 'pad'] <- inserts$pad[j] + nrow(overlap)
} }
inserts <- inserts %>% inserts <- inserts %>%

+ 8
- 0
Readme.Rmd Wyświetl plik



![Example `view_regex(text, pattern)`.](docs/view-regex.png) ![Example `view_regex(text, pattern)`.](docs/view-regex.png)


```r
t_nested <- "anestedgroupwithingroupexample"
r_nested <- "(a(nested)(group(within(group))(example)))"
view_regex(t_nested, r_nested)
```

![Example of nested groups](docs/view-nested.png)



## Planned (ish) ## Planned (ish)



+ 8
- 0
Readme.md Wyświetl plik



![Example `view_regex(text, pattern)`.](docs/view-regex.png) ![Example `view_regex(text, pattern)`.](docs/view-regex.png)


``` r
t_nested <- "anestedgroupwithingroupexample"
r_nested <- "(a(nested)(group(within(group))(example)))"
view_regex(t_nested, r_nested)
```

![Example of nested groups](docs/view-nested.png)

## Planned (ish) ## Planned (ish)


1. An Rstudio addin gadget that allows you to interactively enter the 1. An Rstudio addin gadget that allows you to interactively enter the

BIN
docs/view-nested.png Wyświetl plik

Before After
Width: 1880  |  Height: 302  |  Size: 23KB

Ładowanie…
Anuluj
Zapisz