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.
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.
npm install reggy
yarn add reggy
pnpm add reggy
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!
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();
- 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
- For general issues or questions, open an issue
- For security issues, please send an email to security@blazing.works
- For important questions, please email developers@blazing.works
Reggy is licensed under the MIT License.