Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
is-posix-bracket
Advanced tools
Returns true if the given string is a POSIX bracket expression (POSIX character class).
The is-posix-bracket npm package is designed to check if a string includes a POSIX bracket expression. POSIX bracket expressions are a special kind of syntax used in regular expressions to define a range or class of characters to match. This package provides a simple utility function to detect these expressions in strings, which can be particularly useful when parsing or processing regular expressions or strings in applications that need to handle text patterns.
Detection of POSIX bracket expressions
This feature allows developers to check if a string contains a POSIX bracket expression. The function returns true if the string is a POSIX bracket expression, otherwise false. This is useful for validating or parsing regular expressions in text processing applications.
const isPosixBracket = require('is-posix-bracket');
console.log(isPosixBracket('[[:alpha:]]')); // true
console.log(isPosixBracket('[a-z]')); // false
Micromatch is a powerful globbing library that can match strings using the extended globbing syntax used by bash. It supports POSIX brackets and offers more comprehensive pattern matching capabilities compared to is-posix-bracket. Micromatch provides a broader set of features for matching complex patterns, making it suitable for applications requiring detailed control over string matching.
Matcher is a simple package that allows matching strings against a list of patterns. It supports basic wildcards but does not have built-in support for POSIX bracket expressions. Compared to is-posix-bracket, Matcher is more general-purpose and less specialized, suitable for simpler matching tasks where POSIX bracket detection is not required.
Returns true if the given string is a POSIX bracket expression (POSIX character class).
Install with npm
$ npm i is-posix-bracket --save
var isPosixBracket = require('is-posix-bracket');
isPosixBracket('[foo:]]');
//=> false
isPosixBracket('[xdigit:]]');
//=> false
isPosixBracket('[[:xdigit:]]');
//=> true
isPosixBracket('[[:xdigit:]]');
//=> true
isPosixBracket('[[:alpha:]123]');
//=> true
isPosixBracket('[[:alpha:]123]');
//=> true
isPosixBracket('[a-c[:digit:]x-z]');
//=> true
isPosixBracket('[:al:]');
//=> true
isPosixBracket('[abc[:punct:][0-9]');
//=> true
true
if the given string looks like a glob pattern.Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 01, 2015.
FAQs
Returns true if the given string is a POSIX bracket expression (POSIX character class).
The npm package is-posix-bracket receives a total of 3,078,391 weekly downloads. As such, is-posix-bracket popularity was classified as popular.
We found that is-posix-bracket demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.