• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

re-template-tag: easily compose regular expressions

This package provides the template tag re for composing regular expressions.

Basic syntax

Syntax: the following two expressions produce the same regular expression.

re`/abc/gu`
/abc/gu

Composing regular expressions

import {re} from 're-template-tag';

const RE_YEAR = /([0-9]{4})/;
const RE_MONTH = /([0-9]{2})/;
const RE_DAY = /([0-9]{2})/;
const RE_DATE = re`/^${RE_YEAR}-${RE_MONTH}-${RE_DAY}$/u`;

RE_DATE.test('2017-01-23'); // true

More information

Related work

Acknowledgement

The syntax for separating flags from the actual regular expression is based on an idea by Mathias Bynens.

More Repositories

1

enumify

TypeScript
662
star
2

webpack-es6-demo

JavaScript
213
star
3

proto-js

Proto.js – prototypes as classes
JavaScript
173
star
4

tree-shaking-demo

JavaScript
147
star
5

react-starter-project

Minimal starter project for React: webpack + hot module reloading + ES6 and JSX via Babel
JavaScript
130
star
6

type-right

JavaScript
119
star
7

webpack-babel-demo

JavaScript
102
star
8

strint

String-encoded integers in JavaScript
JavaScript
95
star
9

stringio

Convert strings to Node.js streams and vice versa
TypeScript
94
star
10

generator-examples

Example code from the blog post “ES6 generators in depth”
JavaScript
74
star
11

enums

A simple enum implementation for JavaScript
JavaScript
73
star
12

openurl

Node.js module for opening a URL via the operating system
JavaScript
71
star
13

class-js

Class.js – a simple JavaScript inheritance API
JavaScript
58
star
14

op_overload

Fake operator overloading used by a type Point
JavaScript
47
star
15

node-es6-demo

JavaScript
46
star
16

minimal-react

JavaScript
45
star
17

demo_promise

JavaScript
37
star
18

iterable

HTML
30
star
19

async-iter-demo

JavaScript
27
star
20

exploring-reasonml

26
star
21

async-off

TypeScript
20
star
22

exploring-js

20
star
23

babel-on-node

Demo project demonstrating how to use the ES6 transpiler Babel on Node.js
JavaScript
19
star
24

esnext-demo

Enable pkg.esnext for *untranspiled* source code
JavaScript
19
star
25

ts-demo-webpack

JavaScript
18
star
26

markcheck

Markcheck tests Markdown code blocks – to prevent errors in documentation (readmes, blogs, books, etc.)
TypeScript
18
star
27

toy-promise

JavaScript
17
star
28

node-babel-dynamic-demo

JavaScript
17
star
29

reasonml-demo-modules

OCaml
17
star
30

scripts-help

JavaScript
16
star
31

shared-array-buffer-demo

JavaScript
15
star
32

html_demos

Demos of HTML document features
JavaScript
14
star
33

promise-examples

JavaScript
13
star
34

js-complaints

Common JavaScript complaints
13
star
35

set-methods-polyfill

A polyfill for the ECMAScript proposal “Set Methods for JavaScript”
TypeScript
13
star
36

node-babel-static-demo

JavaScript
12
star
37

lobrow

Load Node.js modules on web browsers
JavaScript
12
star
38

module-bindings-demo

JavaScript
11
star
39

es6-shim

A shim for useful code that will probably be in ECMAScript 6
JavaScript
10
star
40

reasonml-demo-functors

OCaml
9
star
41

babel-config-demo

JavaScript
9
star
42

tackling-ts

9
star
43

exploring-es2018-es2019

8
star
44

jsrepl

Prototype: combine code editing with a JavaScript command line
JavaScript
8
star
45

iterator-helpers-polyfill

TypeScript
8
star
46

lazylines

JavaScript
7
star
47

strmap

A simple map from strings to values in JavaScript
JavaScript
7
star
48

js-feature-matrix

JavaScript
7
star
49

imports-are-views-demo

JavaScript
7
star
50

ts-demo-npm-cjs

A minimal repository that demonstrates how to create CommonJS-based npm packages via TypeScript
TypeScript
7
star
51

env-var

JavaScript
6
star
52

r700_mac

Making the Logitech Presenter R700 work with Macs.
6
star
53

jsreload

Scripts that help with automatically reloading a tab in Safari whenever a file changes
JavaScript
6
star
54

reasonml-demo-iterators

OCaml
6
star
55

async-examples

HTML
6
star
56

universal_modules

A lightweight module system that works both in browsers and Node.js
JavaScript
6
star
57

jsdom_demo

This project shows you how to use jsdom and jQuery on Node.js to examine and transform HTML.
JavaScript
6
star
58

typed-array-demos

HTML
5
star
59

jasmine-intro

JavaScript
5
star
60

npm-bin-demo

JavaScript
4
star
61

inheritance-by-example

Source code for the blog post “JavaScript inheritance by example”
JavaScript
4
star
62

nodejs-tools

Helpers for Node.js that I’m using in my projects
TypeScript
4
star
63

helpers

Helpers for JavaScript and TypeScript that I’m using in my projects
TypeScript
4
star
64

nodejs-shell-scripting

3
star
65

incsync

Incremental backups for Unix (Mac OS X, Linux, ...) via rsync. Think: poor man’s Time Machine.
Shell
3
star
66

copy_url

A bookmarklet for copying URL and title of the current page (for Twitter etc.)
JavaScript
3
star
67

regexps

Several useful regular expressions, unit-tested
2
star
68

demo-shell-scripts

JavaScript
2
star
69

es6_wsh_code

Exercises for my ES6 workshop
JavaScript
2
star
70

snowpack-install-demo

JavaScript
2
star
71

wix-demo

JavaScript
2
star
72

mocha-test-repo

JavaScript
1
star
73

ootools

Library with helpers for JavaScript objects and inheritance
JavaScript
1
star
74

babel-decorator-error

JavaScript
1
star
75

babel-exponentation-bug

JavaScript
1
star
76

log-args

JavaScript
1
star
77

server-side-rendered-css

TypeScript
1
star