Skip to content

Commit

Permalink
Update: use is.character instead of inherits to check type
Browse files Browse the repository at this point in the history
  • Loading branch information
qinwf committed Apr 23, 2016
1 parent 1a9f78b commit accbed0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#' re2_extract("[email protected]", "(.*)@([^.]*)", "\\2!\\1")
#' @export
re2_extract = function(input, pattern, rewrite = "\\1", ...) {
if (!inherits(pattern, "re2exp")) {
if (is.character(pattern)) {
pattern = re2(pattern, ...)
}
cpp_extract(input, pattern, rewrite)
Expand Down
2 changes: 1 addition & 1 deletion R/match.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ re2_match = function(input,
anchor = "none",
all = FALSE,
...) {
if (!inherits(pattern, "re2exp")) {
if (is.character(pattern)) {
pattern = re2(pattern, ...)
}
cpp_match(input, pattern, value, anchor, all)
Expand Down
2 changes: 1 addition & 1 deletion R/replace.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#' re2_replace("yabba dabba doo", "b+","d", all = FALSE) == "yada dabba doo"
#' @export
re2_replace = function(input, pattern, rewrite, all = FALSE, ...) {
if (!inherits(pattern, "re2exp")) {
if (is.character(pattern)) {
pattern = re2(pattern, ...)
}
cpp_replace(input, pattern, rewrite, all)
Expand Down

0 comments on commit accbed0

Please sign in to comment.