rex

by kevinushey

kevinushey / rex

Friendly regular expressions for R.

217 Stars 21 Forks Last release: Not found Other 200 Commits 8 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Rex

Build Status codecov.io Lifecycle: stable <!-- badges: end -->

Friendly Regular Expressions

Regular expressions are very powerful feature, however they are often difficult to interpret. Rex allows you to build complex regular expressions from human readable expressions. So instead of writing (and later trying to decipher)

r
r 

You can write

r 

While these expressions are a big longer than their corresponding regular expression, they are much more readable and maintainable.

Installation

install.packages("rex")

Usage

The vignettes have longer form usage examples.

Each

rex()
function call can include a number of functions and shortcuts. For a full list of the functions available please see
?rex
and
?shortcuts
.

Rex Mode

Rex functions are not exported because they are only useful within

rex()
calls, but they can be temporarily attached using
rex_mode()
which allows them to be auto-completed.

Using Rex in other packages

Using

rex
in other packages will generate spurious NOTEs from
R CMD check
unless you include a call to
rex::register_shortcuts()
with your package name somewhere in your package source. This function registers all of the rex shortcuts as valid variables fixing the NOTEs.

See Also

  • Regularity - Ruby library that partially inspired
    rex
    .
  • PCRE - Perl Compatible Regular Expressions, the engine that
    rex
    regular expressions use.
  • Perl 5 Regular Expressions - Perl regular expression documentation, which are nearly 100% compatible with PCRE.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.