Skip to content

Commit

Permalink
use sub/gsub only with perl=TRUE or fixed=TRUE (bug tidyverse#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed May 1, 2013
1 parent c39d729 commit 47aeb5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/guess.r
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,14 @@ guess_formats <- function(x, orders, locale = Sys.getlocale("LC_TIME"),
r = sprintf("((%s\\D*%s)|%s)",
num[["I"]], alpha[["p"]], num[["H"]]))

num[nms] <- sub("<M", "<M_T",
sub("<S", "<S_T",
sub("<OS", "<OS_T", num[nms])))
num[nms] <- sub("<M", "<M_T", fixed = TRUE,
sub("<S", "<S_T", fixed = TRUE,
sub("<OS", "<OS_T", num[nms], fixed = TRUE)))
}


## don't let special nms be confused with standard formats
num[nms] <- gsub("(<[IMSpHS]|<OS)", "\\1_s", num[nms])
num[nms] <- gsub("(<[IMSpHS]|<OS)", "\\1_s", num[nms], perl = TRUE)


## The difference between flex regexp and exact is that flex should follow
Expand Down

0 comments on commit 47aeb5b

Please sign in to comment.