
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
regexify-string
Advanced tools
Strings decorator (by regex) with: React components, HTML tags etc.
Strings decorator (by regex) with: React components, HTML tags etc.
perfectly works with: strings, html tags, react, react-native
$ npm install --save regexify-string
or
$ yarn add regexify-string
Type: RegExp
Type: (match: string, index: number, result?: RegExpExecArray) => string | JSX.Element
match
string you would like to replace/decorate with somethingindex
index number of the current matchresult?
RegExpExecArrayNOTE: Try do not forget to use keys for React collections if needed
Type: string
const result = regexifyString({
pattern: /\[.*?\]/gim,
decorator: (match, index) => {
return `<${match}>`;
},
input: 'some [text] with simple example',
});
console.log(result);
// ['some ', '<[text]>', ' with simple example']
const result = regexifyString({
pattern: /\[.*?\]/gim,
decorator: (match, index) => {
switch (index) {
case 0: return `<FIRST ${match}>`;
case 1: return `<SECOND ${match}>`;
case 2: return `<THIRD ${match}>`;
default: return match;
}
},
input: 'Important text with [first link] and [second link] and much more [links]',
});
console.log(result);
/*
[
'Important text with ',
'<FIRST [first link]>',
' and ',
'<SECOND [second link]>',
' and much more ',
'<THIRD [links]>',
]
*/
const result = regexifyString({
pattern: /\[.*?\]/gim,
decorator: (match, index) => {
return <span>{match}</span>;
},
input: 'some [text] with simple example',
});
console.log(result);
// ['some ', <span>[text]</span>, ' with simple example']
regexifyString({
pattern: /\[.*?\]/gim,
decorator: (match, index) => {
return (
<Link
to={SOME_ROUTE}
onClick={onClick}
>
{match}
</Link>
);
},
input: someVariablWithData,
});
regexifyString({
pattern: /\[.*?\]/gim,
decorator: (match, index) => {
return <React.Fragment>{match}</React.Fragment>;
},
input: 'some [text] with simple example',
});
const result = regexifyString({
pattern: /\[(?<id>.+)\]\{(?<name>.+)\}/g,
decorator: (match, index, result) => {
return (
<div
id={String(result?.[2])}
title={result?.[1]}
/>
);
},
input: 'a[b]{c}',
});
console.log(result);
// ['a', <div id='c' title='b' />]
MIT © Kas Elvirov
FAQs
Strings decorator (by regex) with: React components, HTML tags etc.
The npm package regexify-string receives a total of 0 weekly downloads. As such, regexify-string popularity was classified as not popular.
We found that regexify-string 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
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.