emoji-regex
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Emoji-regex is a powerful npm package designed to provide a regular expression for matching all emoji symbols and sequences, including the textual representations of emoji, as per the Unicode Standard. This versatility makes it easy to update the emoji-regex whenever new emojis are added to Unicode, enhancing the functionality and adaptability of your JavaScript projects.
To use the emoji-regex npm package in your JavaScript projects, you first need to install it via npm by running the code npm install emoji-regex
in your terminal. Once the installation is complete, you can require the package in your Node.js files and use it to create a regular expression for emoji symbols and sequences. Below is an example of how to use emoji-regex in JavaScript:
const emojiRegex = require('emoji-regex');
const text = `
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
`;
const regex = emojiRegex();
for (const match of text.matchAll(regex)) {
const emoji = match[0];
console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
}
In this example, the emoji-regex is used to create a regular expression that identifies and matches all emoji sequences present in the provided text, logging each matched emoji sequence and its code points length to the console.
The documentation for emoji-regex is provided on its GitHub page: https://github.com/mathiasbynens/emoji-regex. There you can find in-depth information about the use, installation process, maintenance, and licensing of the emoji-regex npm package, guaranteeing a smooth integration of this valuable tool into your JavaScript workflow.