Giter Club home page Giter Club logo

sm_regex's Introduction

My semantic model (tree structure) based regular expression (SM-Regex)

Standard Java regex use as:

Pattern p = Pattern.compile(regexString);
Matcher m = p.matcher(inputString);
m.matches(); //boolean value returned

And my SM-Regex use:

RegularExpression regex = RegularExpressionBuilder.create(regexString);
regex.isMatch(inputString); // boolean value returned

Or:

regex.isFullMath(inputString); //boolean value
/* example:
for regex: "[A-Z][a-z]+" 
String "Vova" - true
String "VovaN" - false

Or method matchedString(String): [for upper example regex]

regex.matchedString("Vova93"); // returned "Vova"

Or method unmatchedString(String):

regex.matchedString("Vova93"); // returned "93"

How it work?

This regular expression processor based on semantic model processing. It is recursive tear down algorithm. This is not optimal of size method. But it work more speedy.

Work steps:

1. Lexer: tokenize input string (regex string) to token stream.
2. Parser: parse token stream to syntax tree
3. Semantic model builder: optimise syntax tree and create analogy semantic model
4. Regular expression builder: include semantic model into resulting regular expression

PS: For good API all this steps packaged in one used patterns Facade and Fabrick Method {GoF]
This is final release (version 1.0)
Не могу не сказать что это велосипедостроение, но все же иногда бывает полезно строить велосипеды, в учебных целях.

Maven

For add it to your project, use maven. And add this dependency in the dependencies block in 'pom.xml'

<dependency>
    <groupId>vova_cons</groupId>
    <artifactId>sm_regex</artifactId>
    <version>1.0.0</version>
</dependency>

Autor

Vladimir Konstantinov
[email protected]
NEFU IMI
October 2016

sm_regex's People

Contributors

anbu93 avatar

Watchers

James Cloos avatar  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.