R/regex_set.R

#' A set of regular expression combination

#' @author Jiaxiang Li
#'
#' @importFrom rebus %R% OPEN_PAREN SPC ANY_CHAR one_or_more or CLOSE_PAREN OPEN_BRACKET CLOSE_BRACKET

web_link <-
    # 'w{1,3}' %R%
    # DOT %R%
    # one_or_more(ANY_CHAR) %R%
    # DOT %R%
    # 'com'
    # It does not work
    'www\\..+\\.(com|cn)'

url_result <-
    OPEN_PAREN %R%
    one_or_more(
        or(
            rebus::SPC
            ,rebus::ANY_CHAR
            ,'/'
            ,':'
            ,'#'
        )
    ) %R%
    CLOSE_PAREN

name_and_url_result <-
    OPEN_BRACKET %R%
    one_or_more(
        or(
            SPC
            ,ANY_CHAR
            ,'\\p{Han}'
        )
    ) %R%
    CLOSE_BRACKET %R%
    OPEN_PAREN %R%
    url_result
JiaxiangBU/add2md documentation built on Jan. 31, 2020, 7:46 p.m.