Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/davidje13/revexp

Given a regular expression, solves for possible matching input strings
https://github.com/davidje13/revexp

regular-expression

Last synced: about 1 month ago
JSON representation

Given a regular expression, solves for possible matching input strings

Awesome Lists containing this project

README

        

# RevExp

This library calculates the possible inputs for a given regular expression.

The supported syntax is modelled on the standard Javascript `RegExp` object's syntax.

You can [try it online](https://regex.davidje13.com/) or in the terminal:

```shell
npx revexp 'H(alp|el{2,}[o]) (Wor|wo)lds?' '??????W????'
```

## Supported Features

| Pattern Feature | Examples | Support |
|--------------------------|------------------------------|---------------|
| Character classes | `a` `[aeiou]` `[^a-z]` `\d` | ✅ Full |
| Character escapes | `\u0020` `\\` `\n` `\(` | ✅ Full |
| Unicode properties | `\p{Letter}` `\p{RGI_Emoji}` | ❌ None |
| Set notation (`v`) | `[[ab]&&[bc]]` `[[ab]--a]` | ✅ Full |
| String literals (`v`) | `[\q{ab\|cd}]` | ✅ Full |
| Branching | `x\|y` | ✅ Full |
| Anchors | `^` `$` | ✅ Full |
| Word boundary assertions | `\b` `\B` | Partial † |
| Standard quantifiers | `a*` `a+` `a?` | ✅ Full |
| Range quantifiers | `a{2}` `a{2,}` `a{2,3}` | ✅ Full |
| Lazy quantifiers | `a+?` `a*?` `a??` `a{2,}?` | ✅ Full |
| Possessive quantifiers | `a++` `a*+` `a?+` `a{2,}+` | ❌ None |
| Groups | `(abc)` `(?abc)` | ✅ Full |
| Backreferences | `(abc)\1` `(?abc)\k` | Partial ‡ |
| Non-capturing groups | `(?:abc)` | ✅ Full |
| Positive lookaheads | `(?=abc)` | ❌ None |
| Negative lookaheads | `(?!abc)` | ❌ None |
| Positive lookbehinds | `(?<=abc)` | ❌ None |
| Negative lookbehinds | `(?