Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

regenerate

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regenerate

Generate JavaScript-compatible regular expressions based on a given set of Unicode symbols or code points.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20M
decreased by-9.46%
Maintainers
1
Weekly downloads
 
Created

What is regenerate?

The 'regenerate' npm package is a tool for creating sets of Unicode symbols and generating regular expressions to match them. It is particularly useful for working with Unicode properties and ranges, making it easier to handle complex character sets in a concise and readable manner.

What are regenerate's main functionalities?

Creating a set of Unicode symbols

This feature allows you to create a set of Unicode symbols by adding individual characters or ranges of characters. In this example, a set containing all uppercase and lowercase English letters is created.

const regenerate = require('regenerate');
const set = regenerate().addRange(0x0041, 0x005A).addRange(0x0061, 0x007A);
console.log(set.toString()); // Output: '[A-Za-z]'

Generating regular expressions

This feature allows you to generate a regular expression from the set of Unicode symbols. The example demonstrates creating a regular expression that matches any uppercase or lowercase English letter.

const regenerate = require('regenerate');
const set = regenerate().addRange(0x0041, 0x005A).addRange(0x0061, 0x007A);
const regex = set.toRegExp();
console.log(regex); // Output: /[A-Za-z]/

Adding individual characters

This feature allows you to add individual Unicode characters to the set. In this example, the set contains the characters 'A' and 'a'.

const regenerate = require('regenerate');
const set = regenerate().add(0x0041).add(0x0061);
console.log(set.toString()); // Output: '[Aa]'

Removing characters or ranges

This feature allows you to remove individual characters or ranges of characters from the set. In this example, the character 'A' is removed from a set of uppercase English letters.

const regenerate = require('regenerate');
const set = regenerate().addRange(0x0041, 0x005A).remove(0x0041);
console.log(set.toString()); // Output: '[B-Z]'

Other packages similar to regenerate

Keywords

FAQs

Package last updated on 22 May 2013

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