
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
regexpstructor
Advanced tools
Build regular expressions via a fluent api
ReStructor.seq(...RegExpstructors) or ReStructor.or(...RegExpstructors) to combine your matchers.Install with
npm i regexpstructor
or with yarn
yarn add regexpstructor
// ES module import:
import ReStructor from "regexpstructor";
// or in commonjs:
const ReStructor = require("regexpstructor");
/**
* @example building a UUID regexp
*/
const hexChar = ReStructor().charOfRanges(["0", "9"], ["a", "f"]);
// tests for [0-9a-f]{8} - eg. "a019bc3f"
const digitBlock_8 = hexChar.repeatExactly(8);
// tests for [0-9a-f]{4} - eg. "bc3f"
const digitBlock_4 = hexChar.repeatExactly(4);
// uuid looks like this: "a019bc3f-1234-5678-9abc-def012345678"
const uuid = digitBlock_8
.then("-")
.then(
// 3 times a 4-digit blocks, each followed by a dash
digitBlock_4.then("-").repeatExactly(3)
)
.then(
// block of size 12
hexChar.repeatExactly(12)
)
.withAnyCase() // make case insensitive
.searchOneLine(); // single line search
// compile the uuid reStructor into a regExp
const regex = uuid.compile();
// use it:
regex.test("a019bc3f-1234-5678-9abc-def012345678"); // result: true
// print it:
console.log(regex); /* logs: /[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}/gi */
FAQs
Build regular expressions in a safe and readable way.
The npm package regexpstructor receives a total of 5 weekly downloads. As such, regexpstructor popularity was classified as not popular.
We found that regexpstructor 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.