rebus.numbers (version 0.0-1)

number_range: 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 lo.
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 or for details.

Value

A character vector representing part or all of a regular expression.

Examples

Run this code
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)

Run the code above in your browser using DataCamp Workspace