1.0.12-alpha • Published 5 years ago

phrasalexpressions v1.0.12-alpha

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

phrasalExpressions

Helps to create regular expressions in typescript from phrases.

! Still in dev.

Table of Contents

Installation

This library only works with typescript. Ensure it is installed:

npm install typescript -g

To install phrasalExpressions:

npm install phrasalExpressions --save

Basic Usage

import {Phrexp} from "phrasalExpressions";

//  Regexp to match e character
const regexp1: Regexp = new Phrexp()
                            .findChar('e')
                            .toRegExp();

// Regexp for exactly 3 repetitions of an alphanumeric followed by a tab
const regexp2: RegExp = new Phrexp()
      .beginRepetition(3, 3)
      .findChar('alphanumeric').endRepetition().findChar('tab')
      .toRegExp();