Description Usage Arguments Details See Also Examples
Lookarounds
1 2 3 4 5 6 7 | x %if_next_is% y
x %if_next_isnt% y
x %if_prev_is% y
x %if_prev_isnt% y
|
x |
A regex pattern. |
y |
A regex pattern. |
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%: TRUE if x follows y
%if_next_isnt%: TRUE if x does not follow y
%if_prev_is%: TRUE if y comes before x
%if_prev_isnt%: TRUE if y does not come before x
Perl 5 Documentation https://perldoc.perl.org/perlre#Extended-Patterns
Other rex:
%or%(),
capture(),
character_class(),
counts,
group(),
not(),
rex(),
shortcuts,
wildcards
1 2 3 4 5 6 | 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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.