Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.15 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.15 KB

RegExpBuilder v1.0

RegExpBuilder integrates regular expressions into the programming language, thereby making them easy to read and maintain. Regular Expressions are created by using chained methods and variables such as arrays or strings.

How to start

There are implementations available for Dart, Javascript, Java, and Python.

Examples

Here are a couple of examples using Javascript:

Money

var digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
var regex = new RegExpBuilder()
  .then("$")
  .some(digits)
  .then(".")
  .exactly(2).from(digits)
  .getRegExp();
  
regex.test("$10.00")); // true

Nested patterns

var pattern = new RegExpBuilder()
  .min(1).of("p")
  .min(2).of("q");

var regex = new RegExpBuilder()
  .exactly(2).like(pattern)
  .getRegExp();

regex.test("pqqpqq"); // true

API documentation

RegExpBuilder can represent literally every possible regular expression using methods such as either(), or(), behind(), asGroup() and so on. You can find the API documentation for each language here.