
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Convert a glob to a RegExp
object.
.
-> \\.
)*
and **
are replaced^
and end with $
RegExp
syntax is validnew RegExp
const globRegex = require('glob-regex')
// Match no directory.
let re = globRegex('*.js')
re.test('a.js') // => true
re.test('a.css') // => false
re.test('a/b.js') // => false
// Use ? operator for optional character.
re = globRegex('*.jsx?')
re.test('a.js') // => true
re.test('b.jsx') // => true
// Match any directory.
re = globRegex('**.css')
re.test('a.css') // => true
re.test('a/b.css') // => true
// Match any directory and specific name.
re = globRegex('**/a.css')
re.test('a.css') // => true
re.test('b/a.css') // => true
// Use | operator to match multiple values.
re = globRegex('*.(js|css)')
re.test('a.js') // => true
re.test('a.css') // => true
Use globRegex.replace()
to transform a glob into a RegExp-compatible string.
NOTE: It's not recommended to use globRegex(array)
if you need
the exec
method, since the result will be difficult to make use of.
Using the test
method works great, though!
FAQs
Tiny glob->regex converter
The npm package glob-regex receives a total of 153,819 weekly downloads. As such, glob-regex popularity was classified as popular.
We found that glob-regex 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
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.