Skip to content

Commit

Permalink
one more try addressing #31
Browse files Browse the repository at this point in the history
  • Loading branch information
JBGruber committed Dec 1, 2023
1 parent bced4e1 commit dafb80e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions R/rwhatsapp.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ rwa_read <- function(x,
pattern = "^\\d{2,4}.\\d{2}.\\d{2,4} - \\d{2}:\\d{2}[^;]+;|^\\d{2,4}-\\d{2}-\\d{2,4}[^-]+ -"
)
if (sum(is.na(time)) > (length(time) * 0.9)) {
time <- stri_extract_first_regex(str = chat_raw,
pattern = "[^]]+] ")
time <- stri_extract_first_regex(
str = chat_raw,
pattern = "[^-]+ - "
)
}
if (sum(is.na(time)) > (length(time) * 0.9)) {
time <- stri_extract_first_regex(
str = chat_raw,
pattern = "^[^A-z]*\\d{1,2}:\\d{1,2}(\\sAM|\\sPM){0,1}"
pattern = "[^]]+] "
)
}
if (sum(is.na(time)) > (length(time) * 0.9)) {
time <- stri_extract_first_regex(
str = chat_raw,
pattern = "[^-]+ - "
pattern = "^[^A-z]*\\d{1,2}:\\d{1,2}(\\sAM|\\sPM){0,1}"
)
}

Expand Down Expand Up @@ -346,11 +348,11 @@ f_exist_s <- function(x) {
})
))
files_exist <- isTRUE(any(
tryCatch(file.exists(x),
error = function(e) {
tryCatch(file.exists(x),
error = function(e) {

})
))
})
))
url_exist || files_exist
}

Expand Down

0 comments on commit dafb80e

Please sign in to comment.