@rux12/t_rex
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

T_REX

NFA/DFA based Regex Machine

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contact
  6. Acknowledgements

About The Project

I always wanted to know how Regular Expressions worked. That took me down this deep rabbit hole of Formal Grammar, Chomsky Hierarchy, Kleene Star and etc.

I also had been learning Haskell at the time and the concept of Finite State Machine came up time and again. It turns out I can utilize FSA to implement Regex Engines. So I did.

Getting Started

Install through your favorite package manager to get started.

Installation

npm install @rux12/t_rex
yarn add @rux12/t_rex

Usage

Basic Usage:

import {build} from "@rux12/t_rex";

const re = build("/(ab|cd)/");

re.matches("ab") // true
re.matches("cd") // true
re.matches("ef") // false

You could also use the builders provided.

import {char, or} from "@rux12/t_rex";

const re = or(
	char("a"),
	char("b")
);

re.matches("a") // true
re.matches("b") // true
re.matches("e") // false

Roadmap

  • [ ] Add Wildcard Support (for now)

Contact

Email: rux12@icloud.com

Project Link: https://github.com/Sangi-it/t_rex

Acknowledgments

Package Sidebar

Install

npm i @rux12/t_rex

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

173 kB

Total Files

51

Last publish

Collaborators

  • rux12