Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mukel/regularexpressions
Simple RegExp matching using derivatives
https://github.com/mukel/regularexpressions
Last synced: 1 day ago
JSON representation
Simple RegExp matching using derivatives
- Host: GitHub
- URL: https://github.com/mukel/regularexpressions
- Owner: mukel
- Created: 2015-07-24T02:11:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-27T14:30:36.000Z (over 9 years ago)
- Last Synced: 2024-12-22T05:14:15.568Z (12 days ago)
- Language: Scala
- Size: 250 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Regular Expressions
[![Travis CI Build Status](https://travis-ci.org/mukel/RegularExpressions.svg)](https://travis-ci.org/mukel/RegularExpressions)
[![Coverage Status](http://coveralls.io/repos/mukel/RegularExpressions/badge.svg?branch=master&service=github)](http://coveralls.io/github/mukel/RegularExpressions?branch=master)
This is a simple library to deal with regular expressions using derivatives, based on Brzozowski's 1964 paper "Derivatives of regular expressions".
## Performance Notice
This is a non-optimized implementation and is focused purely on correctness, so the raw complexity is exponential.
## Usage
It provides integration with the language, allowing the following:
```scala
val lowerCase: RE = 'a' range 'z'
val upperCase: RE = 'A' range 'Z'
val vowels: RE = "aeiou".oneOf
val digit: RE = '0' range '9'
val nonZeroDigit: RE = '1' range '9'
val unsigned: RE = "0" | (nonZeroDigit ~ digit.*)
val integer: RE = ("-" | "+").? ~ unsigned
val alphaNum = lowerCase | upperCase | digit
```
Matching is as simple as:```scala
integer matches "1234"
email matches "[email protected]"
```