const regex = new RegExp('(?P<Module>^\\w+)+\\s+(?P<Name>.{1,}(?=Ke|Fi))+(?P<Type>(Kernel|File System))', 'gm')
const str = `1394ohci 1394 OHCI-совместимый Kernel
3ware 3ware Kernel 19.05.2015 3:28:03
ACPI Драйвер Microsoft ACPI Kernel
AcpiDev Драйвер устройств с AC Kernel
acpiex Microsoft ACPIEx Drive Kernel
acpipagr Драйвер агрегатора про Kernel
AcpiPmi Драйвер устройства изм Kernel
acpitime Драйвер ACPI Wake Alar Kernel
Acx01000 Acx01000 Kernel
ADP80XX ADP80XX Kernel 10.04.2015 1:49:48
AFD Драйвер дополнительных Kernel
afunix afunix Kernel
ahcache Application Compatibil Kernel
amdgpio2 Драйвер GPIO-клиента A Kernel 07.02.2019 14:32:20
amdi2c Служба контроллера I2C Kernel 20.03.2019 9:57:33
AmdK8 AMD K8 драйвер процесс Kernel
AmdPPM Драйвер процессора AMD Kernel
amdsata amdsata Kernel 14.05.2015 17:14:52
amdsbs amdsbs Kernel 12.12.2012 2:21:44
amdxata amdxata Kernel 01.05.2015 5:55:35
AppID Драйвер AppID Kernel
applockerflt Драйвер фильтра Smartl Kernel
bindflt Windows Bind Filter Dr File System
bowser Браузер File System
BtFilter BtFilter Kernel 25.01.2019 10:46:26`;
// 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