
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
regex-prepared-statements
Advanced tools
SQL like prepared statements for regular expressions
Regex prepared statements helps with sanitizing user inputs for usage in regular expression statements.
Similar to SQL's ?
, this library uses a sequence of special characters <_>
that will be replaced with sanitized
inputs via escape-string-regexp
as a peer dependency.
npm install regex-prepared-statements
Additionally you'll need to install the peer dependency escape-string-regexp
npm install escape-string-regexp
Simple replacement:
regexp('^foo<_>baz$')('bar') // Produces a regex '^foobarbaz$'
Passing flags:
regexp('^foo<_>baz$', 'i)'('bar') // Produces a regex '^foobarbaz$'
Multiple place holders:
regexp('^<_><_><_>$')('foo', 'bar', 'baz') // Produces a regex '^foobarbaz$'
Regex syntax within a placeholder:
regexp('_<>_<_>?/?_<_>?.*')('.*)*.*///', '<_>')) // Produces a regex '_<>_\\.\\*\\)\\*\\.\\*\\/\\/\\/?\\/?_<_>?.*'
For use cases where you just need a simple sanitization:
regexpSimple(".?") // Produces a regex '\\.\\?'
We suggest using this eslint rule to help enforce the usage of this regex library:
"no-restricted-syntax": ["error", {
"selector": "NewExpression[callee.name='RegExp']",
"message": "Use regexp() prepared regex function instead.",
}],
FAQs
SQL like prepared statements for regular expressions
The npm package regex-prepared-statements receives a total of 2 weekly downloads. As such, regex-prepared-statements popularity was classified as not popular.
We found that regex-prepared-statements 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.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.