Giter VIP home page Giter VIP logo

openregex-scala's Introduction

OpenRegex-scala

OpenRegex is written by Michael Schmitz at the Turing Center http://turing.cs.washington.edu/. It is licensed under the Lesser GPL. Please see the LICENSE file for more details.

OpenRegex-scala provides scala bindings against OpenRegex. The Scala bindings use Scala collections as well as providing a more familiar API for Scala users.

OpenRegex-scala also includes a PatternParser implementation that uses reflection to run over any class out of the box. Any public field or 0-argument method may be used to match against a string. There is an exact string matcher (single quotes) and a regular expression matcher (forward slashes). Multiple aspects of a class can be matched against and combined with a logical expression.

    case class Point(x: Int, y: Int)
    val parser = PatternParsers.reflectionWithLogic[Point]
    val regex = parser("<x='1' | x='2'> <x='3' & y='3'>")
    regex.matches(Seq(Point(1, 1), Point(3, 3)))

Using regular expressions, the pattern could have been expressed equivalently.

    val regex = parser("<x=/[12]/> <x='3' & y='3'>")

openregex-scala's People

Contributors

schmmd 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.