Socket
Socket
Sign inDemoInstall

astral-regex

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    astral-regex

Regular expression for matching astral symbols


Version published
Weekly downloads
18M
decreased by-16.6%
Maintainers
1
Install size
4.33 kB
Created
Weekly downloads
 

Package description

What is astral-regex?

The astral-regex npm package is designed to provide a regular expression for matching astral symbols in text. Astral symbols are Unicode symbols that consist of a pair of surrogate halves and are used to represent characters outside the Basic Multilingual Plane (BMP). This package is particularly useful for applications that need to process, validate, or manipulate text containing such symbols, ensuring compatibility with the full range of Unicode characters.

What are astral-regex's main functionalities?

Matching astral symbols

This feature allows you to match and extract astral symbols from a string of text. The code sample demonstrates how to use the package to find astral symbols within a given string. In this example, the astral symbol '𠮷' is successfully matched and extracted from the text.

"𠮷野家".match(astralRegex()); // Returns ['𠮷']

Other packages similar to astral-regex

Readme

Source

astral-regex Build Status

Regular expression for matching astral symbols

Install

$ npm install astral-regex

Usage

const astralRegex = require('astral-regex');

astralRegex({exact: true}).test('🦄');
//=> true

'foo 🦄 💩 bar'.match(astralRegex());
//=> ['🦄', '💩']

API

astralRegex([options])

Returns a RegExp for matching astral symbols.

options

Type: Object

exact

Type: boolean
Default: false (Matches any astral symbols in a string)

Only match an exact string. Useful with RegExp#test() to check if a string is a astral symbol.

License

MIT © Kevin Mårtensson

Keywords

FAQs

Last updated on 05 Apr 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc