GithubHelp home page GithubHelp logo

regex's Introduction

Simple NFA-based regex engine.


0.0.1

  • 支持匹配字符范围 ASCII
  • 支持重复符 *,?,+(有限次匹配待实现)
  • 支持范围表示的字符 eg. [A-Z]可以表示大写字母中任意一个
  • 支持并联运算(|)和串联运算
  • match_all_text接口,若整个文本匹配正则表达式返回true,否则返回false
  • match_points接口,返回文本的index,表示文本的[0,index]能匹配正则表达式

下面是一个简单的实例。

match_all_text("abbacadaaefa", R"(((ab*|ac*)*|ad*|ef)*)");//返回true.
match_points("abbacadaaefa",R"(((ab*|ac*)*|ad*|ef)*)");
		//返回所有的index,表示任意index前的字串都能匹配

0.0.2

已实现

  • 重复符的有限次匹配(Finish!)
    • {m,n} 匹配m-n次
    • {m} 匹配m次
    • {m,} 匹配m-Max次
  • 为NFA做了个缓存,在试图以相同正则表达式来匹配时,节省构造NFA开销。

待实现

  • 0.0.1版本的一些数据结构的优化以及语法树的重构

0.0.3-???

  • 正向预查,反向预查,匿名捕获,命名捕获,命名检查,边界,贪婪,非贪婪(能不能实现看缘分吧:)

regex's People

Contributors

smokingmouse avatar

Stargazers

 avatar velor2012 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.