Learn R Programming

rex (version 0.1.0)

counts: Counts

Description

Functions to restrict a regex to a specific number

Usage

n_times(x, n, type = c("greedy", "lazy", "possessive"))

between(x, low, high, type = c("greedy", "lazy", "possessive"))

at_least(x, n, type = c("greedy", "lazy", "possessive"))

at_most(x, n, type = c("greedy", "lazy", "possessive"))

Arguments

x
A regex pattern.
n
An integer number
type
the type of match to perform.

There are three match types

  1. greedy: match the longest string. This is the default matching type.
  2. lazy: match the shortest string. This matches the shortest string from the same anc

low
An integer number for the lower limit.
high
An integer number for the upper limit.

Functions

  • n_times:xmust occur exactlyntimes.
  • between:xmust occur betweenlowandhightimes.
  • at_least:xmust occur at leastntimes.
  • at_most:xmust occur at mostntimes.

See Also

Other rex: ., capture, capture_group; %if_next_is%, %if_next_isnt%, %if_prev_is%, %if_prev_isnt%, lookarounds; %or%, or; any_of, character_class, except, except_any_of, except_some_of, exclude_range, none_of, one_of, range, some_of; group; maybe, one_or_more, wildcards, zero_or_more, zero_or_one; not; rex, rex_; shortcuts