
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
verbose-regexp
Advanced tools
This module provides a way to use verbose regular expressions in
JavaScript and TypeScript, similar to re.VERBOSE
in Python. It
provides that white-space at the start and end of lines are ignored,
as are newlines, and anything following //
to the end of the line.
It allows you to easily write multi-line regular expressions, and to make your regular expressions more self-documenting using formatting and comments.
Example:
import { rx } from 'verbose-regexp'
// or: const { rx } = require('verbose-regexp')
const dateTime = rx`
(\d{4}-\d{2}-\d{2}) // date
T // time separator
(\d{2}:\d{2}:\d{2}) // time
`
console.log(dateTime.exec(new Date().toISOString()))
You can also embed regular expressions within each other, to allow a complicated regular expression to be built up in steps from simpler parts, e.g.:
const date = rx`\d{4}-\d{2}-\d{2}`
const time = rx`\d{2}:\d{2}:\d{2}`
const dateTime = rx`
(${date}) // date
T // time separator
(${time}) // time
`
console.log(dateTime.exec(new Date().toISOString()))
Note that embedded sub-expressions are automatically surrounded with (?:
and )
, so that they are always treated as a self-contained unit. Also note
that embedded sub-expressions will be run using the flags of the parent
expression, regardless of what flags were on the sub-expression - so, for
example, if the sub-expression had the 'case insensitive' flag set but the
parent expression didn't, then the sub-expression will be executed in a
case sensitive manner.
You can use regular expression flags by accessing them as a property of rx
,
e.g.:
const alpha = rx.i`[a-z]+`
const allAlpha = rx.gi`[a-z]+`
If you want to use a string that would otherwise be ignored (i.e. whitespace
or //
), you can simply escape it with backslashes or a character class:
const url = rx.i`
[ ]*([a-z]+):\/\/ // scheme
([^/]+) // location
(?:/(.*)) // path
`
FAQs
Verbose Regular Expressions
The npm package verbose-regexp receives a total of 18 weekly downloads. As such, verbose-regexp popularity was classified as not popular.
We found that verbose-regexp 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.