/MaxRegex

My attempted to write the start of a regex system. Prompted by a Q on LeetCode. It is also to help understand compilers a bit more.

Primary LanguageJava

MaxRegex

My attempted to write the start of a regex system. Prompted by a Q on LeetCode. It is also to help understand compilers a bit more.

How To Run

To run simple regex use SimpleRegex. To run the more elaborate version of regex use the api in MaxRegex.

Example

Simple Regex

import src.regex.SimpleRegex;
        
String testString = "AABBCC";
String pattern = "AAB+C.";
SimpleRegex regex = new SimpleRegex(testString, pattern);

// 'matches' will be true.
boolean matches = regex.matches();

Elaborate Regex

import src.regex.MaxRegex;

String testString = "AABBCC";
String pattern = "AAB+C.";

// 'matches' will be true.
boolean matches = MaxRegex.whollyContainedIn(pattern, testString);