Skip to content

Commit

Permalink
rearrange some of the functions and what files they belong to, adjust…
Browse files Browse the repository at this point in the history
… the pkgdown template accordingly, update differences vignette
  • Loading branch information
tylerlittlefield committed Mar 24, 2019
1 parent 1eb8c42 commit 098b334
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 40 deletions.
28 changes: 28 additions & 0 deletions R/rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,31 @@ rx_range <- function(.data = NULL, value) {
value <- lapply(value, function(i) paste0(i[1], "-", i[2]))
paste0(.data, "[", paste0(unlist(value, use.names = FALSE), collapse = ""), "]")
}

#' Find beginning or end of a word.
#'
#' @description Match beginning or end of a word—a string consisting of of word
#' characters (a–z, A–Z, 0–9 or _).
#'
#' @param .data Expression to append, typically pulled from the pipe \code{ \%>\% }
#'
#' @examples
#' rx_word_edge()
#'
#'x <- rx_word_edge() %>%
#' rx_alpha() %>%
#' rx_one_or_more() %>%
#' rx_word_edge()
#'
#'# create inputs
#'string1 <- "foobar"
#'string2 <- "foo 23a bar"
#'
#'# matches 'foobar'
#'regmatches(string1, regexpr(x, string1))
#'# matches 'foo' and 'bar' separately
#'regmatches(string2, gregexpr(x, string2))
#' @export
rx_word_edge <- function(.data = NULL){
paste0(.data, "\\b")
}
28 changes: 0 additions & 28 deletions R/special_characters.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,34 +313,6 @@ rx_word <- function(.data = NULL) {
paste0(.data, "\\w+")
}


#' Find beginning or end of a word.
#'
#' @description Match beginning or end of a word—a string consisting of of word characters (a–z, A–Z, 0–9 or _).
#'
#' @param .data Expression to append, typically pulled from the pipe \code{ \%>\% }
#'
#' @examples
#' rx_word_edge()
#'
#'x <- rx_word_edge() %>%
#' rx_alpha() %>%
#' rx_one_or_more() %>%
#' rx_word_edge()
#'
#'# create inputs
#'string1 <- "foobar"
#'string2 <- "foo 23a bar"
#'
#'# matches 'foobar'
#'regmatches(string1, regexpr(x, string1))
#'# matches 'foo' and 'bar' separately
#'regmatches(string2, gregexpr(x, string2))
#' @export
rx_word_edge <- function(.data = NULL){
paste0(.data, "\\b")
}

#' Match a word character.
#'
#' @description Match a word character (a–z, A–Z, 0–9 or _).
Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ reference:
- '`rx_something`'
- '`rx_something_but`'
- '`rx_start_of_line`'
- '`rx_word_char`'
- '`rx_word_edge`'
- title: Lookarounds
desc: ~
Expand Down Expand Up @@ -58,6 +57,7 @@ reference:
- '`rx_uppercase`'
- '`rx_whitespace`'
- '`rx_word`'
- '`rx_word_char`'
- title: Capture Groups
desc: ~
contents:
Expand Down
2 changes: 2 additions & 0 deletions docs/articles/differences-between-the-js-repo.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions docs/reference/rx_word_edge.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/rx_word_edge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vignettes/differences-between-the-js-repo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ There are a handful of differences between the JavaScript repository. Below is a
4. In a similar not, aliases in general are not included because I want the number of functions to be as minimal as possible.
5. The function `add` is not included because the pipe is used instead.
6. The function `replace` is not included because there are R functions already designed for this purpose.
7. The function `or` is excluded in favor of `rx_either_of`.
8. Function names are prefixed with `rx_` for convenience and avoiding namespace collisions.

0 comments on commit 098b334

Please sign in to comment.