Code Monkey home page Code Monkey logo

regrep's Introduction

Introduction

regrep an implementation of command-line tool similar to grep in Golang using trigram and a basic state machine

License

Basics

The current implementation of regrep is based on automata theory and guarantees that searches complete in linear time with respect to the size of the input and in a fixed amount of stack space. regrep utilizes Trigram-accelerated regex search. This essentially means that each byte is processed once during index build-up and later during the actual regular expression build - hence the name regrep

A trigram is a substring of 3 consecutive characters, or runes.

For example - The trigrams of trigram are: tri, rig, igr, gra and ram.

Valid regular expressions are able to be converted to a trigram query against the index. regrep searches the trigram index for possible matches and then runs the full regular expression against the possibles. Each regular expressions must match at least one trigram.

It’s a good idea to think carefully about regular expression queries. The more possible trigrams matched by a query, the more results are checked against the full regular expression and the less efficient the query. The reverse, however, is also true. The more trigrams enforced by the regular expression, the better use regrep can make of the index and the smaller the possible results set.

Building

The current distribution requires 'golang' and 'docker' for running the build/test setup. The common options to try out are 'make' or 'make tests'

The default settings use Alpine Linux image [Busybox + musl-libc] for smaller footprint.

Reference

About

This project was created by Piyush Dewnani

regrep's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.