const regex = /LLPart1:(.*?)LLPart2/gims;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('LLPart1:(.*?)LLPart2', 'gims')
const str = `BundleFormat: 1
Name: TestIllegalStringsLintalist
Description: Created just to see what strings Lintalist uses
Author: Gurlan Vasile
TitleMatch: .txt
Patterns:
- LLPart1: [[Calendar=]]
LLPart2: >>date
LLKey:
LLShorthand: >>calendar
LLScript:
- LLPart1: Syntax:
__multilinevar --> create multiline variable
Notepad++:
__lngAuto --> Notepad++ : change language to Autohotkey
AHK Studio:
__refresh --> AHK Studio : refresh project
Other:
__tgs --> any editor : paste tags template
__newcode --> any editor : create code for Lintalist to be displayed properly
__lintalist --> any editor : create code for Lintalist to be displayed properly
LLPart2:
LLKey:
LLShorthand: >>>?
LLScript:
- LLPart1: messagebox show
LLPart2:
LLKey:
LLShorthand:
LLScript: MsgBox, Test
- LLPart1: wfaw
LLPart2: fwa
LLKey:
LLShorthand:
LLScript:
- LLPart1: some code here
LLPart2: some descriptive text here
LLKey:
LLShorthand: smcd
LLScript: msgbox, HelloWorld
`;
// 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