rexs
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

REXS

CodeFactor Codecov Build Downloads

REXS is a language to create regular expressions. It can be used to create more readable and easy-to-modify expressions that compile to clean and readable regular expressions.

Example

An example usage of REXS can be to match on any URL that starts with http:// or https://, then match any subdomains, followed by the domain and .com:

assert(START);

match("http");

repeat(0, 1) {
    match("s");
}

match("://");

repeat(0, inf, nongreedy) {
    repeat(1, inf, nongreedy) {
        match(ANY);
    }
    match(".");
}

group() {
    repeat(1, inf, nongreedy) {
        match(ANY);
    }

    match(".com");
}

assert(END);

This example will be compiled to /^https?:\/\/(?:.+?\.)*?(.+?\.com)$/.

Package Sidebar

Install

npm i rexs

Weekly Downloads

1

Version

1.0.3

License

Apache-2.0

Unpacked Size

157 kB

Total Files

34

Last publish

Collaborators

  • uellenberg