Skip to content

Deftextra/regexEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Regex engine implementation

The aim of this project is to create a regular expression engine using Thompson's construction

Note: This is a personal educational project and is not meant to be used inside a production environment.

At the current stage in development, the engine converts each regex expression into its corresponding non deterministic finite automata and supports only text directed matching.

Possible additional features.

  • Regex-directed matching features, such as look back and capture groups.

Usage

Development

There are three empty folders: lib, bin and include which are populated by Make install.

To build to project, from the project root directory run the following commands:

> rm -rf build && mkdir build
> git submodule init && git submodule update
> cd build
> cmake ...
> make && make install

or you can run the script build.sh to execute a clean build.

Engine

Currently we have the class NDFA which a converts a regular expression to an automata by passing the regular expression as an argument:

std::string regex = "a*|a*b"
NDFA corrosponding_automata{regex};

std::string text1 {"aaaaaaaa"};
std::string text2 {"aaaaaaaab"};
std::string text3 {"bb"};

std::cout << corrosponding_automata.match(text); // prints true
std::cout << corrosponding_automata.match(text); // prints true
std::cout << corrosponding_automata.match(text3) // prints false

About

Simple regex engine implementation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published