New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

match-recursive

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

match-recursive

Recursive regex matching for matching nested constructs

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
53
-33.75%
Maintainers
1
Weekly downloads
 
Created
Source

#match-recursive Build Status

Recursive regular expression matching for nested constructs

Heavily inspired by Steven Leviathan's article.

Ever wanted to match all contents between braces in a string, only to run into trouble with unmatched braces? Here's the solution!

Each [balanced, so this ']' bracket is ignored] subgroup will be matched recursively, ((2 + 2)*2)^2 will also match the outer group '(2 + 2)*2'. A second invocation will match the inner group '2+2'.

npm install match-recursive

##Usage examples

var matchRecursive = require("match-recursive");

matchRecursive("test    ",      "(...)");     // returns:   []
matchRecursive("(t(e)s)()t",    "(...)");     // returns:   ["t(e)s", ""]
matchRecursive("t<e>>st",       "<...>");     // returns:   ["e"]
matchRecursive("t<<e>st",       "<...>");     // returns:   ["e"]
matchRecursive("t<<e>>st",      "<...>");     // returns:   ["<e>"]
matchRecursive("<|t<e<|s|>t|>", "<|...|>");   // returns: ["t<e<|s|>t"]

Keywords

regex

FAQs

Package last updated on 21 Jun 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