https://github.com/alenvelocity/regexus
Human-readable regular expressions for TS/JS
https://github.com/alenvelocity/regexus
human-readable regex regexp regular-expression
Last synced: 6 months ago
JSON representation
Human-readable regular expressions for TS/JS
- Host: GitHub
- URL: https://github.com/alenvelocity/regexus
- Owner: AlenVelocity
- Created: 2023-12-04T09:53:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-04T14:55:35.000Z (almost 2 years ago)
- Last Synced: 2025-04-15T03:12:34.277Z (6 months ago)
- Topics: human-readable, regex, regexp, regular-expression
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/regexus
- Size: 107 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# RegExus
Human Readable Regular Expressions for JS/TS
Port of [`regexpbuilderphp`](https://github.com/gherkins/regexpbuilderphp)
## Usage
### via NPM
```bash
npm install regexus
``````typescript
import { RegExpBuilder } from 'regexus'; // esm
// or
const { RegExpBuilder } = require('regexus'); // commonjs
```### via CDN
```html```
### Example
```typescript
const builder = new RegExpBuilder()
.startOfInput()
.exactly(3).digits()
.then('-')
.min(2).max(5).letters()
.endOfInput();const regExp = builder.getRegExp();
const testString = '123-abcde';if (regExp.test(testString)) {
console.log('The string matches the pattern!');
} else {
console.log('No match found.');
}
```## API Reference
Coming soon
## Contributing
Contributions are welcome! Please open a pull request or an issue if you would like to contribute.