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

0.0.2 • Public • Published

RegExus

Human Readable Regular Expressions for JS/TS

Port of regexpbuilderphp

Usage

via NPM

npm install regexus
import { RegExpBuilder } from 'regexus'; // esm
// or
const { RegExpBuilder } = require('regexus'); // commonjs

via CDN

<script src="https://cdn.jsdelivr.net/npm/regexus@0.0.2/dist/regexus.umd.js"></script>

Example

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.

Package Sidebar

Install

npm i regexus

Weekly Downloads

1

Version

0.0.2

License

ISC

Unpacked Size

31.6 kB

Total Files

8

Last publish

Collaborators

  • alensaito1