use strict;
my $str = '# Scoring import {#calculate-score}
Loads Scoring*csv files from the WebDAV and import them locally.
While processing and when finished, the file gets renamed on the WebDAV.
# Response export {#unsubscribe-export}
Exports unsubscribes, bounces and complaints and stores the export files
on an SFTP of the customer.
# Campaign uploader {#15mins-campaign-uploader}
Fetches a ZIP from the customers SFTP.
This ZIP must contain a JSON and a HTML. Images must be stored in a `img`
folder. Size limit for an image is 1 MB. Images will be uploaded to the
Suite media library. Campaign meta data will be read from the JSON.
**This process is currently deactivated**
# ecard invite a friend landing page {#recommendation-form}
A form to invite friends. The friends data will be stored in the Suite account.
# Pretrip form {#pretrip-information-form}
Asking the end user to provide more more data before they arrive.
# Signup pages and preference center {#preference-center}
Pages to subscribe and to manage personal data.';
my $regex = qr/^#+\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