Giter VIP home page Giter VIP logo

regex-engine's Introduction

Rust Regex Engine

โš ๏ธ Warning: This project is for educational purposes only and is not intended for production use.

Introduction

This project is a custom regex engine implemented in Rust. It aims to provide fundamental regex functionalities with a focus on learning and understanding the inner workings of regex processing.

Usage

To use this regex engine in your Rust project, include it as a module and use the Regex struct to compile and match regex patterns.

Example

use rust_regex_engine::Regex;

fn main() {
    let regex = Regex::new("^[hH]ello,? [wW]orld ?!").unwrap();
    let res = regex.find("Hello, world!");
    println!("Does it match? {}", res.is_match());
}

Features

  • Basic regex pattern matching.
  • Support for quantifiers like *, +, and ?.
  • Anchors for start (^) and end ($) of the string.
  • Basic character classes.
  • Non-capturing groups.
  • (More features to be implemented)

TODO

  • Implement find() function to return a Match structure, which includes:
    • .matched (bool): Indicates if the pattern was matched.
    • .start (usize): Starting index of the match.
    • .end (usize): Ending index of the match.
    • range(): Provides the range of indices for the matched substring.
  • Add support for character classes [].
  • Implement non-capturing groups (?:abc)*.
  • Implement capturing groups (abc).

Tests

Basic tests are implemented to ensure the functionality of various regex patterns and quantifiers. Additional tests will be added along with the development of new features.

regex-engine's People

Contributors

ckafrouni avatar

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.