const regex = /^(.*ViPNet CSP( \(версия)? 4\.2\)?|\"Крип(р|т)оПро CSP\" \(?версия (4\.0|3\.9)\)?|Криптотокен (2 )?ЭП.*|Рутокен ЭЦП.*)/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(.*ViPNet CSP( \\(версия)? 4\\.2\\)?|\\"Крип(р|т)оПро CSP\\" \\(?версия (4\\.0|3\\.9)\\)?|Криптотокен (2 )?ЭП.*|Рутокен ЭЦП.*)', 'gm')
const str = `"КрипроПро CSP" (версия 4.0)
"КриптоПро CSP" (версия 3.6)
"КриптоПро CSP" (версия 3.9)
"КриптоПро CSP" (версия 4.0)
"КриптоПро CSP" версия 3.6
"КриптоПро CSP" версия 3.9
"КриптоПро CSP" версия 4.0
Crypto-Pro GOST R 34.10-2001 Cryptographic Service Provider 3.9
Crypto-Pro GOST R 34.10-2001 Cryptographic Service Provider 4.0
JCrypto SDK 2.7.3-R321
ViPNet CSP (версия 3.2)
ViPNet CSP (версия 4.2)
ViPNet CSP 4.0
ViPNet CSP 4.1
ViPNet CSP 4.2
Криптотокен ЭП (0c53000205156035)
Рутокен ЭЦП 2.0 (0c53000216296035)
Криптотокен 2 ЭП (0c53002119206034)
Криптотокен ЭП (4e3900052631304c)
Криптотокен ЭП (4e46001821075047)
Рутокен ЭЦП (4e46001839795047)
Криптотокен ЭП (4e46001951815047)
СКЗИ «Криптотокен» в составе изделия «JaCarta ГОСТ»
Средство криптографической защиты информации (СКЗИ) ViPNet CSP 4.2
Средство криптографической защиты информации ViPNet CSP 4.2
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions