const regex = /(Change )(.*)( on)|(^\.\.\.)(.*)/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(Change )(.*)( on)|(^\\.\\.\\.)(.*)', 'gm')
const str = `Change 193745 by mnghiem@vanquan__VIETW462__ROM on 2020/05/13 06:08:50 :\\thuy_unreal\\ROM Client stream: //Romeo/virtuosSubmit Current directory: c:\\Users\\thuy.nguyen Peer address: 192.1
[Lighting] Virtuos updated bake light for seq030 4/1/root Server date: 2020/05/20 04:29:58 -0500 CDT Server uptime: 821:40:43 Server version: P4D/LINUX26X86_64/201
Affected files ... crypted Broker cert expires: Apr 3 20:48:58 2022 GMT Broker version: P4BROKER/LINUX26X86_64/2020.1/1953492 Broker
... //Romeo/main/UnrealEngine/Project/Content/CinematicDemo/SubLevels/Lighting/CDemo_ESP_sq030_1:25:01 2022 GMT Broker version: P4BROKER/LINUX26X86_64/2019.2/1897966 Proxy address: P4ROM:1667 Proxy version: P4LGT.umap#16 edit 021/02/24) (expires 2020/06/14) Server license-ip: 192.168.3.4:2003 Case Handling: sensitive
... //Romeo/main/UnrealEngine/Project/Content/CinematicDemo/SubLevels/Lighting/CDemo_ESP_sq030_LGT_BuiltData.uasset#9 edit 5_050/sq035_050_LGT.uasset#12 edit
Differences ...
==== //Romeo/main/UnrealEngine/Project/Content/CinematicDemo/SubLevels/Lighting/CDemo_ESP_sq030_LGT.umap#16 (binary+l) ==== 0/sq030_LGT.uasset#18 edit
==== //Romeo/main/UnrealEngine/Project/Content/CinematicDemo/SubLevels/Lighting/CDemo_ESP_sq030_LGT_BuiltData.uasset#9 (binary+l) ====`;
// 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