New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yorkjs/pattern

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yorkjs/pattern

pattern

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

Pattern

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

安装

CDN

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

</script>

NPM

npm install @yorkjs/pattern
import { parseText } from '@yorkjs/pattern'

YARN

yarn add @yorkjs/pattern
import { parseText } from '@yorkjs/pattern'

示例

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' }
//   }
// ]

Keywords

FAQs

Package last updated on 08 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc