const regex = new RegExp('(\\+91[\\s-]\\d{5}[\\s-]\\d{5})|(011[\\s-]\\d{8})|(\\+91\\d{2}[\\s-]\\d{8})|(^0\\d{10})|(^[6-9]\\d{9})|(91[\\s-]\\d{3,5}[\\s-]\\d{2,5}[\\s-]\\d{4})|(91[\\s-]\\d{5}[\\s-]\\d{5})|(91[\\s-]\\d{10})|(\\d{4}[\\s-]\\d{4}[\\s-]\\d{3})', 'gm')
const str = `r1: (\\+91[\\s-]\\d{5}[\\s-]\\d{5})|(011[\\s-]\\d{8})|(\\+91\\d{2}[\\s-]\\d{8})|(^0\\d{10})|(^[6-9]\\d{9})|(91[\\s-]\\d{3,5}[\\s-]\\d{3,5}[\\s-]\\d{4})|(91[\\s-]\\d{5}[\\s-]\\d{5})|(91[\\s-]\\d{10})
+91-98600 27066 /
+91-73871 11066
011-29534999, 011-29532555, 011 47527999
+9133 24798066,
+9133 24483458/3459
08048620522
8046041848
91 124 392 3000
91-80884 00951
91-9821328595
91 9822015432
+91 033 2461 8212
+91 033 2461 8213
645+91-98600 270664684 /
6546+91-73871 11066656
011-29534999, 011-29532555, 011 47527999
+9133 24798066656,
+9133 24483458/3459
8048620522656
8046041848656
91 124 392 3000656
91-80884 00951656
91-9821328595656656
91 9822015432656
656+91 033 2461 8212
+91 033 2461 8213656
`;
// 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