Socket
Socket
Sign inDemoInstall

char-regex

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    char-regex

A regex to match any full character, considering weird character ranges.


Version published
Weekly downloads
22M
decreased by-0.86%
Maintainers
1
Install size
5.31 kB
Created
Weekly downloads
 

Package description

What is char-regex?

The char-regex npm package provides a regular expression to match all the symbols in a string, including those outside the Basic Multilingual Plane (BMP). This is particularly useful for handling and manipulating strings containing complex characters, such as emojis or certain language scripts, which are represented by surrogate pairs in JavaScript.

What are char-regex's main functionalities?

Matching all characters in a string

This code demonstrates how to use char-regex to match and extract all characters, including complex emojis, from a string. The result is an array of individual characters, making it easier to manipulate or analyze the text at a character level.

const charRegex = require('char-regex');

const text = 'Hello, world! 👋🌍';
const characters = text.match(charRegex());
console.log(characters);

Other packages similar to char-regex

Readme

Source

Char Regex Travis CI Build Status

A regex to match any full character, considering weird character ranges. Extracted from https://github.com/lodash/lodash/blob/master/.internal/unicodeSize.js.

NPM Badge

Install

npm install char-regex

Usage

const charRegex = require("char-regex");

"❤️👊🏽".match(/./)
//=> ["", "", "", "", "", "", ""]

"❤️👊🏽".match(charRegex())
//=> ["❤️", "👊🏽"]

API

charRegex()

Keywords

FAQs

Last updated on 31 Jan 2020

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