Giter VIP home page Giter VIP logo

regexorder's Introduction

PyPI version PyPI pyversions PyPI license

Search the regex that fits all querying strings.

  • Dozens of pre-written regexes are indexed and organized as a partial order, available in regexorder/templates.json.

  • The regex of all the querying strings' least upper bound in the partial order is returned.

  • templates.svg plots the partial order.

Templates

The core part is the pre-written regexes and their respective structure. Currently they only cover the most common cases.

  • Any idea or contribution is highly welcome.

For interesting applications of this library, please refer to extratools.

Reference

This library is part of the implementation for our research paper under review. If you plan to use it for research purpose, please cite either this repo or our paper accordingly.

  • Detailed information of our paper will be released soon.
@misc{regexorder,
  author = {Chuancong Gao},
  title = {{RegexOrder}},
  howpublished = "\url{https://github.com/chuanconggao/RegexOrder}",
  year = {2018}
}

Installation

This package is available on PyPI. Just use pip3 install -U RegexOrder to install it.

Our regexes utilize some advanced Unicode features, that are not available in standard re library yet. Thus, the more advanced regex library must be used to match our regexes.

Examples

from regexorder import RegexOrder

r = RegexOrder()

t = r.match("123")
t.name
# 'pos_int'
t.regex
# '\\+?\\d+'

t = r.matchall(["apple", "banana", "cheese cake"])
t.name
# 'lower_words'
t.regex
# '\\p{Ll}+(\\s+\\p{Ll}+)*'

regexorder's People

Contributors

chuanconggao avatar toddrme2178 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

sandy4321

regexorder's Issues

Invalid Syntax in setup.py line 17

I tried to install regexorder from pypi but encountered this issue.

download_url=f"{url}/tarball/{version}",
                                              ^
SyntaxError: invalid syntax

The error disappeared after I removed "f".

I am using windows subsystem for linux with a ubuntu 16.04 executable environment.

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.