use strict;
my $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
';
my $regex = qr/(\+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})/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html