Title: | Numeric Extensions for the 'rebus' Package |
Version: | 0.0-1.1 |
Date: | 2015-12-16 |
Author: | Richard Cotton [aut, cre] |
Maintainer: | Richard Cotton <richierocks@gmail.com> |
Description: | Build regular expressions piece by piece using human readable code. This package contains number-related functionality, and is primarily intended to be used by package developers. |
Depends: | R (≥ 3.1.0) |
Imports: | rebus.base, utils |
Suggests: | testthat |
License: | Unlimited |
LazyLoad: | yes |
Acknowledgments: | Development of this package was partially funded by the Proteomics Core at Weill Cornell Medical College in Qatar <http://qatar-weill.cornell.edu>. The Core is supported by 'Biomedical Research Program' funds, a program funded by Qatar Foundation. |
RoxygenNote: | 7.3.2 |
Collate: | 'imports.R' 'number_range.R' 'roman.R' |
NeedsCompilation: | no |
Packaged: | 2025-07-10 15:43:14 UTC; hornik |
Repository: | CRAN |
Date/Publication: | 2025-07-10 16:31:31 UTC |
Generate a regular expression for a number range.
Description
Generates a regular expression that matches a sequence of numbers.
Usage
number_range(lo, hi, allow_leading_zeroes = FALSE, capture = FALSE)
Arguments
lo |
An integer. |
hi |
An integer greater than or equal to |
allow_leading_zeroes |
A logical value. Are leading zeroes allowed to bulk the match up to the length of the number with the most digits? |
capture |
A logical value. See |
Value
A character vector representing part or all of a regular expression.
Examples
number_range(0, 255)
number_range(0, 255, allow_leading_zeroes = TRUE)
number_range(10000, 19999)
number_range(6, 54321)
number_range(-77, 77)
number_range(-77, 77, capture = TRUE)
number_range(-77, 77, capture = NA)
Roman numerals
Description
Match roman numerals.
Usage
ROMAN
roman(lo, hi)
Arguments
lo |
A non-negative integer. Minimum number of repeats, when grouped. |
hi |
positive integer. Maximum number of repeats, when grouped. |
Format
An object of class regex
(inherits from character
) of length 1.
See Also
Examples
# Constant form and character class
ROMAN
roman()
x <- c("MMMDCCCXLVIII", "MMMCMDCCCXLVIIV")
rx <- rebus.base::exactly(roman())
grepl(rx, x)