Files
klz-cables.com/.pnpm-store/v10/files/c8/5b86d6dac7cf08d51cf86ee168f9b0c2af5ec4667c1ff4dd0ad49f74e1bd8f50cc239dae45e092e865ee3c5e05c4cef5c9025c06a6c7cade22a0fefbb4e9b3
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

14 lines
746 B
Plaintext

export const wordBoundariesRegex = (input)=>{
const words = input.split(' ');
// Regex word boundaries that work for cyrillic characters - https://stackoverflow.com/a/47062016/1717697
const wordBoundaryBefore = '(?:(?:[^\\p{L}\\p{N}])|^)' // Converted to a non-matching group instead of positive lookbehind for Safari
;
const wordBoundaryAfter = '(?=[^\\p{L}\\p{N}]|$)';
const regex = words.reduce((pattern, word, i)=>{
const escapedWord = word.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
return `${pattern}(?=.*${wordBoundaryBefore}.*${escapedWord}.*${wordBoundaryAfter})${i + 1 === words.length ? '.+' : ''}`;
}, '');
return new RegExp(regex, 'i');
};
//# sourceMappingURL=wordBoundariesRegex.js.map