use strict;
my $str = 'curl \'https://i-tools.cys.com/api/v1/places/nearby?latitude=-6.30491801&longitude=106.6861089&radius_in_km=0.5&providers=internaltopv2&limit=10&msg_id=aa0cabd1-db82-11ea-af17-1d5f5xxxxx\' \\
-H \'authority: i-tools.cys.com\' \\
-H \'accept: application/json, text/plain, */*\' \\
-H \'authorization: axZhbGciOiJSUzI1NiIsImtpZCI6Il9kZWZhdWx0IiwidHlwIjoiSldUIn0.eyJhdWQiOiJHRU8tVE9PTFMiLCJleHAiOjE2MDgxMDgxNDYsImlhdCI6MTYwODAyMTc0MywianRpIjoiNDA2NjI5NzgtN2RmMS00MDE5LThjZTktMTZkMTFlMjY4NmYyIiwibG1lIjoiR09PR0xFVjMiLCJuYW1lIjoiIiwic3ViIjoiNWU1ZWQyM2YtNGRkMi00YmY3LThkNTEtZGM0MzY0NDdmNzg5In0.IXBubd0NrCaVEyrnaskH4CO50nP5qLz-6G02IBpy0vnPAjHcFeLd4OdocN2TinuBiK_LtgIfIgLCOJx_A3hsNCqnAbIRKfKV6b7xO7HSLNXIT3PS8iAy_z2I5bW4-hUcKJkrMJcgHA8j2bBZGlAPaDf6PkjdzFM7M0P_kXk5H_zKyO2prAQA-eh3UYUr22PLptLsusWMAfXFGf42eUoNz6gq8KKWzaO0wc7FqrYD-rLz50xDMuwLS9J-su4TzIhpJgaMKq8rIvNyy5nAs-77IhG_foaIelVY6ZGFgUe_dvq0Ox9JrR8tqLV7kRwMf7EAIgbdKN-Xxu8ZbulhhuxNZA\' ^
-H \'i-tools-params: {"client_version":"v11.0.1xxxx"}\' \\
-H \'user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Mobile Safari/537.36\' \\
-H \'x-app-identity: i_tools\' \\
-H \'origin: https://i-tools.cys.net\' \\
-H \'sec-fetch-site: cross-site\' \\
-H \'sec-fetch-mode: cors\' \\
-H \'sec-fetch-dest: empty\' \\
-H \'referer: https://i-tools.cys.net/ops-tools/place-nearby-v2\' \\
-H \'accept-language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7\' \\
--compressed';
my $regex = qr/authorization:\s(.*)\s\^/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