Title: | Numeric Extensions for the 'rebus' Package |
---|---|
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. |
Authors: | Richard Cotton [aut, cre] |
Maintainer: | Richard Cotton <[email protected]> |
License: | Unlimited |
Version: | 0.0-1 |
Built: | 2024-11-19 05:56:04 UTC |
Source: | https://github.com/richierocks/rebus.numbers |
Generates a regular expression that matches a sequence of numbers.
number_range(lo, hi, allow_leading_zeroes = FALSE, capture = FALSE)
number_range(lo, hi, allow_leading_zeroes = FALSE, capture = FALSE)
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 |
A character vector representing part or all of a regular expression.
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)
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)
Match roman numerals.
ROMAN roman(lo, hi)
ROMAN roman(lo, hi)
lo |
A non-negative integer. Minimum number of repeats, when grouped. |
hi |
positive integer. Maximum number of repeats, when grouped. |
An object of class regex
(inherits from character
) of length 1.
# Constant form and character class ROMAN roman() x <- c("MMMDCCCXLVIII", "MMMCMDCCCXLVIIV") rx <- rebus.base::exactly(roman()) grepl(rx, x)
# Constant form and character class ROMAN roman() x <- c("MMMDCCCXLVIII", "MMMCMDCCCXLVIIV") rx <- rebus.base::exactly(roman()) grepl(rx, x)