Skip to content

๐Ÿ“• Powerful and easy to read RegEx builder by BlazingWorks

License

Notifications You must be signed in to change notification settings

blazingworks/reggy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

reggy

๐Ÿ“• Powerful and easy to read RegEx builder by BlazingWorks

License Contributors GitHub last commit

What is Reggy?

Reggy is a powerful and easy to read RegEx builder. It is attempting to be usable without the need of checking documentation frequently by providing various aliases and attempting to be as intuitive as possible.

Current status (โš ๏ธ)

Reggy is currently just a proof of concept and it not yet ready for production use. Reggy will currently not work with a variety of runtime environments at this time.

Installation

npm install reggy
yarn add reggy
pnpm add reggy

Usage

import { r } from "reggy";

const characterLineRegex = r
  .lineStart()
  .fragment(r.text("<").group(r.oneOrMore(r.uppercase())).text(">"))
  .fragment(r.oneOrMore(r.whitespace()))
  .group(r.oneOrMore(r.any()))
  .lineEnd()
  .buildRegex();

const string = "<MIKU> Hello World!";
const match = string.match(characterLineRegex);
console.log(match[1]); // MIKU
console.log(match[2]); // Hello World!

Concepts

Fragments

Fragments are the building blocks of Reggy. They are used to build up more complex RegExes. Fragments can be combined with other fragments and can be reused.

Example:

const username = r.timesOrMore(r.alphanumeric(), 3);
const message = r.fragment(username).text(": ").group(r.oneOrMore(r.any()));
const messageRegex = message.buildRegex();

Special Thanks & Sponsors

How to report issues / questions

License

Reggy is licensed under the MIT License.

BlazingWorks Open-Sourcd