# @yorkjs/pattern

> pattern

Latest version **0.0.3** (published 2023-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yorkjs/pattern
pnpm add @yorkjs/pattern
yarn add @yorkjs/pattern
bun add @yorkjs/pattern
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-05-08 |
| First published | 2023-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | musicode |
| Maintainers | shushu2013, musicode |
| Keywords | text, pattern, parse |

## Links

- npm: https://www.npmjs.com/package/@yorkjs/pattern
- Repository: https://github.com/yorkjs/pattern
- Homepage: https://github.com/yorkjs/pattern#readme
- Issues: https://github.com/yorkjs/pattern/issues
- npm.io page: https://npm.io/package/@yorkjs/pattern

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-05-08
- 0.0.2 — 2023-04-19
- 0.0.1 — 2023-03-01

## README

# Pattern

通过正则表达式简单地解析文本。

## 安装

CDN

```html
<script src="https://unpkg.com/@yorkjs/pattern"></script>
<script>

</script>
```

NPM

```shell
npm install @yorkjs/pattern
```

```js
import { parseText } from '@yorkjs/pattern'
```

YARN

```shell
yarn add @yorkjs/pattern
```

```js
import { parseText } from '@yorkjs/pattern'
```

## 示例

```js
import {
  parseText,
} from '@yorkjs/pattern'

const result = parseText('请点击https://www.baidu.com，请联系13512345678，请发送邮箱adsadasd@qq.com，高亮<i>关键字</i>，图片<img src="https://www.baidu.com/logo.png">')
// [
//   { type: 'text', text: '请点击' },
//   {
//     type: 'url',
//     text: 'https://www.baidu.com',
//     data: { url: 'https://www.baidu.com' }
//   },
//   { type: 'text', text: '，请联系' },
//   { type: 'tel', text: '13512345678', data: { tel: '13512345678' } },
//   { type: 'text', text: '，请发送邮箱' },
//   {
//     type: 'email',
//     text: 'adsadasd@qq.com',
//     data: { email: 'adsadasd@qq.com' }
//   },
//   { type: 'text', text: '，高亮' },
//   {
//     type: 'highlight',
//     text: '<i>关键字</i>',
//     data: { tag: 'i', text: '关键字' }
//   },
//   { type: 'text', text: '，图片' },
//   {
//     type: 'image',
//     text: '<img src="https://www.baidu.com/logo.png">',
//     data: { url: 'https://www.baidu.com/logo.png' }
//   }
// ]
```

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