reggy
v1.0.0
Published
<div align="center">
Downloads
3
Readme
reggy
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
- BlazingWorks - for funding and maintaining the development of Reggy
- OfficialCRUGG - for the idea of Reggy
- zod - for the inspiration of the Syntax
- Hop - for serving as a reference for setting up
tsup
(@onehop/js) - TypeScript - for powering this project
How to report issues / questions
- For general issues or questions, open an issue
- For security issues, please send an email to [email protected]
- For important questions, please email [email protected]
License
Reggy is licensed under the MIT License.