All Projects → IMax153 → expressive-ts

IMax153 / expressive-ts

Licence: MIT license
A functional programming library designed to simplify building complex regular expressions

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to expressive-ts

Proposal Regexp Unicode Property Escapes
Proposal to add Unicode property escapes `\p{…}` and `\P{…}` to regular expressions in ECMAScript.
Stars: ✭ 112 (+43.59%)
Mutual labels:  regex, regular-expressions
simplematch
Minimal, super readable string pattern matching for python.
Stars: ✭ 147 (+88.46%)
Mutual labels:  regex, regular-expressions
Nim Regex
Pure Nim regex engine. Guarantees linear time matching
Stars: ✭ 136 (+74.36%)
Mutual labels:  regex, regular-expressions
url-regex-safe
Regular expression matching for URL's. Maintained, safe, and browser-friendly version of url-regex. Resolves CVE-2020-7661 for Node.js servers.
Stars: ✭ 59 (-24.36%)
Mutual labels:  regex, regular-expressions
Rverbalexpressions
💬 Create regular expressions easily
Stars: ✭ 245 (+214.1%)
Mutual labels:  regex, regular-expressions
Ore
An R interface to the Onigmo regular expression library
Stars: ✭ 54 (-30.77%)
Mutual labels:  regex, regular-expressions
Npeg
PEGs for Nim, another take
Stars: ✭ 163 (+108.97%)
Mutual labels:  regex, regular-expressions
Social Media Profiles Regexs
📇 Extract social media profiles and more with regular expressions
Stars: ✭ 324 (+315.38%)
Mutual labels:  regex, regular-expressions
Regex For Regular Folk
🔍💪 Regular Expressions for Regular Folk — A visual, example-based introduction to RegEx [BETA]
Stars: ✭ 242 (+210.26%)
Mutual labels:  regex, regular-expressions
Fancy Regex
Rust library for regular expressions using "fancy" features like look-around and backreferences
Stars: ✭ 199 (+155.13%)
Mutual labels:  regex, regular-expressions
Inferregex
Infer the regular expression (regex) of a string 🔤 🔢 🔍
Stars: ✭ 41 (-47.44%)
Mutual labels:  regex, regular-expressions
ChatControl-Pro
The ultimate chat solution. Prevent spam, ads, swears and even bots on your server. Replaced by ChatControl Red: https://mineacademy.org/chatcontrol-red
Stars: ✭ 65 (-16.67%)
Mutual labels:  regex, regular-expressions
Verbalex
A library for creating complex, composable regular expressions with the reader & writer in mind. 🔍
Stars: ✭ 26 (-66.67%)
Mutual labels:  regex, regular-expressions
Youtube Regex
Best YouTube Video ID regex. Online: https://regex101.com/r/rN1qR5/2 and http://regexr.com/3anm9
Stars: ✭ 87 (+11.54%)
Mutual labels:  regex, regular-expressions
Py regular expressions
Learn Python Regular Expressions step by step from beginner to advanced levels
Stars: ✭ 770 (+887.18%)
Mutual labels:  regex, regular-expressions
Regex
An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.
Stars: ✭ 2,125 (+2624.36%)
Mutual labels:  regex, regular-expressions
Re Flex
The regex-centric, fast lexical analyzer generator for C++ with full Unicode support. Faster than Flex. Accepts Flex specifications. Generates reusable source code that is easy to understand. Introduces indent/dedent anchors, lazy quantifiers, functions for lex/syntax error reporting, and more. Seamlessly integrates with Bison and other parsers.
Stars: ✭ 274 (+251.28%)
Mutual labels:  regex, regular-expressions
Regex
The Hoa\Regex library.
Stars: ✭ 308 (+294.87%)
Mutual labels:  regex, regular-expressions
Grex
A command-line tool and library for generating regular expressions from user-provided test cases
Stars: ✭ 4,847 (+6114.1%)
Mutual labels:  regex, regular-expressions
moar
Deterministic Regular Expressions with Backreferences
Stars: ✭ 19 (-75.64%)
Mutual labels:  regex, regular-expressions

Expressive-ts Logo

Build Status Badge

expressive-ts is a functional programming library designed to simplify building complex regular expressions.

Expressive-ts

Table of contents

Installation

npm install fp-ts expressive-ts

or

yarn add fp-ts expressive-ts

Note: fp-ts is a peer dependency of expressive-ts

Why?

The expressive nature of the expressive-ts API makes it incredibly easy to understand the purpose of an otherwise cryptic regular expression. Function composition is a core component of the API. By composing together the various functions provided by expressive-ts, extremely complex regular expressions can be built easily.

Usage

Lets imagine that we would like to recognize and validate a basic URL. Here's how it would look using expressive-ts.

import { pipe } from 'fp-ts/lib/function'
import * as E from 'expressive-ts/lib/Expression'

const expression = pipe(
  E.compile, // expressions always begin with a call to `compile`
  E.startOfInput,
  E.string('http'),
  E.maybe('s'),
  E.string('://'),
  E.maybe('www.'),
  E.anythingBut(' '),
  E.endOfInput,
  E.toRegex
)

assert.strictEqual(expression.test('https://www.google.com'), true)
assert.strictEqual(expression.test('https://google.com'), true)
assert.strictEqual(expression.test('http://google.com'), true)
assert.strictEqual(expression.test('http:/google.com'), false)
assert.strictEqual(expression.test('http://goog le.com'), false)

Documentation

Prior Art

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].