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

regex

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regex

Native RegExp compatible regular expressions for JavaScript. Patterns may be composed of subexpressions and multiple expressions may be combined into a single expression.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
784K
decreased by-7.02%
Maintainers
1
Weekly downloads
 
Created
Source

Regex

Native RegExp compatible regular expressions for JavaScript. Patterns may be composed of subexpressions and multiple expressions may be combined into a single expression.

Installation

Regex may be installed on node.js via the node package manager using the command npm install regex.

You may also install it on RingoJS using the command ringo-admin install aaditmshah/regex.

You may install it as a component for web apps using the command component install aaditmshah/regex.

Usage

The Regex constructor is compatible with the native RegExp constructor. You may pass it a regexp object or a source string:

var Regex = require("regex");
var regex = new Regex(/(a|b)*abb/);

Methods

Like the native RegExp constructor instances of Regex have the following methods:

test

The test method is used to simply test whether a string matches the regex pattern:

regex.test("abb");   // true
regex.test("aabb");  // true
regex.test("babb");  // true
regex.test("aaabb"); // true
regex.test("ababb"); // true
regex.test("abba");  // false
regex.test("cabb");  // false

Operations

The Regex constructor currently supports the following regex operations:

  1. Concatenation
  2. Alternation
  3. Grouping
  4. Closure

Changelog

The following changes were made in this version of Regex:

v0.1.0

  • Supports basic regex operations - concatenation, alternation, grouping and closure. No support for pattern composition or combining subexpressions yet.

Keywords

FAQs

Package last updated on 28 Mar 2014

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