Closed FelixErnst closed 4 years ago
@jimhester
~In addition re_matches function does not work anymore. The following snippet produces a valid output in R 3.6.2, but not on R-devel~
dat <- read_html(sprintf('http://bioconductor.org/checkResults/3.5/bioc-LATEST/',version))
rowspan <- length(html_text(html_nodes(dat,xpath='/html/body/table[@class="node_specs"]/tr[@class!=""]')))
pkgnames <- html_text(html_nodes(dat,xpath=sprintf('/html/body/table[@class="mainrep"]/tr/td[@rowspan="%s"]',rowspan)))
y <- re_matches(pkgnames,
rex(
start,
# matches .standard_regexps()$valid_package_name
rex:::capture(shortcuts$alpha,rex:::any_of(shortcuts$alnum,"."),shortcuts$alnum, name = "pkg"),
maybe(shortcuts$any_blanks),
# matches .standard_regexps()$valid_package_version
rex:::capture(rex:::between(rex:::group(shortcuts$digits,rex:::character_class(".-")),1,""),shortcuts$digits, name = "version"),
maybe(shortcuts$any_blanks),
rex:::capture(shortcuts$anything,name='author'),
"Last",shortcuts$anything,"Commit:",
rex:::capture(shortcuts$anything,name="commit"),
"Last",shortcuts$anything,'Changed',shortcuts$anything,"Date:",shortcuts$any_non_alnums,
rex:::capture(rex:::any_of(list(shortcuts$digit,'-',shortcuts$blank,':')),name='last_changed_date')
))
~On R-devel all values are NA.~
edit: the last bit is a problem with the function regexpr
. So disregard this
edit2: I posted the problem with differing regexpr
behavior to bug-report-request@r-project.org using the following code snippet:
dat <- read_html('http://bioconductor.org/checkResults/3.5/bioc-LATEST/')
pkgnames <- html_text(html_nodes(dat,xpath='/html/body/table[@class="mainrep"]/tr/td[@rowspan="3"]'))
pattern <- "^(?<pkg>[[:alpha:]][[:alnum:].]*[[:alnum:]])(?:[[:blank:]]*)?(?<version>(?:(?:[[:digit:]]+[.-])){1,}[[:digit:]]+)(?:[[:blank:]]*)?(?<author>.*)Last.*Commit:(?<commit>.*)Last.*Changed.*Date:[^[:alnum:]]*(?<last_changed_date>[[:digit:]\\-[:blank:]:]*)"
regexpr(pattern = pattern, text = pkgnames, perl = TRUE)
Correct positions are not returned on R-devel (r77738)
They are not supposed to be exported, they are used within a call to rex
. You can use rex::rex_mode()
to temporarily put the shortcuts on the search path to make autocompletion when writing rex expressions easier.
Thanks for the clarification. I couldn't find anything about this in the man pages. Did I miss it?
It is documented at https://github.com/kevinushey/rex#rex-mode
Thanks. I totally missed this. I was looking for a hint in the man pages.
Hi,
somehow rex does not behave as expect on R-devel
Apparently the functions are not exported. Checking the NAMESPACE file in this repo, this seems to be the case. I don't know, why this doesn't happen on R 3.6.2, but there seems to be a new behavior on R-devel.
My money would be on a problem in the
register
functionFelix