const regex = /(?s)(\d+)\n +(.*?)\s*(?=\d+\n)/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?s)(\\d+)\\n +(.*?)\\s*(?=\\d+\\n)', 'gm')
const str = `7. On 6 March 2013, the Appeals Chamber filed the Decision on Victim
Participation, in which it decided that the victims “may, through their legal
1
The full citation, including the ICC registration reference of all designations and abbreviations used in
this judgment are included in Annex 1.
2
A more detailed procedural history is set out in Annex 2 of this judgment.
ICC-01/04-02/12-271-Corr 07-04-2015 7/117 EK A
8/117
representatives, participate in the present appeal proceedings for the purpose of
presenting their views and concerns in respect of their personal interests in the issues
on appeal”.
3
8. On 19 March 2013, the Prosecutor filed, confidentially, ex parte, available to the
Prosecutor and Mr Ngudjolo only, the Document in Support of the Appeal. The
Prosecutor filed a confidential redacted version of the Document in Support of the
Appeal on 22 March 2013, and a public redacted version of the Document in Support
of the Appeal on 3 April 2013. In the redacted version of the Document in Support of
the Appeal, the Prosecutor’s entire third ground of appeal was redacted. `;
// 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