Lookarounds
Details
These functions provide an interface to perl lookarounds.
Special binary functions are used to infer an ordering, since often you might wish to match a word / set of characters conditional on the start and end of that word.
%if_next_is%:TRUEif x follows y%if_next_isnt%:TRUEif x does not follow y%if_prev_is%:TRUEif y comes before x%if_prev_isnt%:TRUEif y does not come before x
See also
Perl 5 Documentation https://perldoc.perl.org/perlre#Extended-Patterns
Other rex:
%or%(),
capture(),
character_class(),
counts,
group(),
not(),
rex(),
shortcuts,
wildcards
Examples
stopifnot(grepl(rex("crab" %if_next_is% "apple"), "crabapple", perl = TRUE))
stopifnot(grepl(rex("crab" %if_prev_is% "apple"), "applecrab", perl = TRUE))
stopifnot(grepl(rex(range("a", "e") %if_next_isnt% range("f", "g")),
"ah", perl = TRUE))
stopifnot(grepl(rex(range("a", "e") %if_next_is% range("f", "i")),
"ah", perl = TRUE))