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

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

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.