Skip to content

Deterministic Regular Expressions with Backreferences

License

Notifications You must be signed in to change notification settings

moar-regex/moar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moar

Deterministic Regular Expressions with Backreferences. Uses Memory Occurence Automata to match the input.

ANTLR is used for Pattern compilation.

Theoretical Background

A Paper explaining the theoretical background is currently being written.

Supported Syntax

The supported Pattern syntax can easily be seen in the ANTLR grammar:

Examples

MoaPattern pattern = MoaPattern.compile("^Deterministic|OrNot$");
MoaMatcher matcher = pattern.matcher("Deterministic");
if ( matcher.matches() ) {
  System.out.println("yay");
}

Or this cool language:

MoaPattern pattern = MoaPattern.compile("((?<y>\\k<x>)(?<x>\\k<y>a))+");
MoaMatcher matcher = pattern.matcher("aaaa");
if( matcher.matches() ) {
  System.out.println("yay again.");
}