# retemplate

> Regular Expressions using tagged templates

Latest version **1.0.1** (published 2020-06-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install retemplate
pnpm add retemplate
yarn add retemplate
bun add retemplate
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-06-28 |
| First published | 2019-01-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 54.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ron Buckton |
| Maintainers | rbuckton |

## Links

- npm: https://www.npmjs.com/package/retemplate
- Repository: https://github.com/rbuckton/retemplate
- Homepage: https://github.com/rbuckton/retemplate#readme
- Issues: https://github.com/rbuckton/retemplate/issues
- npm.io page: https://npm.io/package/retemplate

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^1.9.3
- [regexp-match-indices](https://npm.io/package/regexp-match-indices.md) ^1.0.2

## Recent versions

- 1.0.1 (latest) — 2020-06-28
- 1.0.0 — 2020-06-28
- 0.0.5 — 2020-03-09
- 0.0.4 — 2019-01-13
- 0.0.3 — 2019-01-13
- 0.0.2 — 2019-01-12
- 0.0.1 — 2019-01-12

## README

# retemplate

Regular Expressions using Tagged Templates

# Installation

```
npm i retemplate
```

# Usage

```ts
import { R } from "retemplate";

// composing regular expressions with tagged templates:
const unsafe = "hello?";
const part = R`(?<part>${unsafe})`;
const whole = R`say ${part}`;
const re = new RegExp(whole); // re = /say (?:(?<part>hello\?))/
re.test("say hello?"); // true

// composite matchers
const results = R.matchAll({
    [R`foo`]: 0,
    [R`bar(\d)`]: (_, cap) => parseInt(cap),
    [R`baz`]: R.BREAK,
    [R`quxx`]: 3
}, "foo bar1 bar2 baz quxx");

result; // [0, 1, 2]
```

---
_Source: https://npm.io/package/retemplate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
