Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/davidje13/revexp
- Owner: davidje13
- License: mit
- Created: 2021-09-13T21:56:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T02:20:09.000Z (about 1 year ago)
- Last Synced: 2024-04-25T01:40:18.113Z (8 months ago)
- Topics: regular-expression
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 | `(?