use strict;
my $str = 'The current wave of protests formed through the coming together of three elements. <i>First</i>, some students demonstrated on various university campuses (mainly Táchira) for at least two weeks before the big 12 February 2014 protests. They protested against <i>insecurity</i> and Venezuela’s high crime rates. Vivia Sequera from the Christian Science Monitor claims that students at the University of the Andes were initially protesting an attempted rape of a young woman on campus.<a title="" href="#_ftn1">[1]</a>
some opposition leaders mobilised their supporters and the Venezuelan Student Movement to protest against the government and call for its resignation – prominently <i>Leopoldo López</i>, leader of the centrist party Voluntad Popular (VP, Popular Will), <i>MarÃa Corina Machado</i> of the liberal party Vente Venezuela (Come Venezuela) and <i>Antonio Ledezma</i> of the social democratic party Alianza Bravo Pueblo (Fearless People\'s Alliance).<a title="" href="#_ftn2">[2]</a> It is sig
<div><br clear="all" />
<hr align="left" size="1" width="33%" />
<div>
<a title="" href="#_ftnref1">[1]</a> { ADDIN ZOTERO_ITEM CSL_CITATION {"citationID":"klJTkj1B","properties":{"formattedCitation":"{\\\\rtf Vivia Sequera, \\\\uc0\\\\u8220{}Did Attempted Rape Ignite Venezuela\\\\uc0\\\\u8217{}s National Protests?,\\\\uc0\\\\u8221{} \\\\i Christian Science Monitor\\\\i0{}, February 22, 2014, http://www.csmonitor.com/World/Latest-News-Wires/2014/0222/Did-attempted-rape-ignite-Venezuela-s-national-protests.}","plainCitation":"Vivia Sequera, “Did Attempted Rape Ignite Venezuela’s National Protests?,†Christian Science Monitor, February 22, 2014, http://www.csmonitor.com/World/Latest-News-Wires/2014/0222/Did-attempted-rape-ignite-Venezuela-s-national-protests."},"citationItems":[{"id":1080,"uris":["http://zotero.org/groups/228165/items/U8EBSIQM"],"uri":["http://zotero.org/groups/228165/items/U8EBSIQM"],"itemData":{"id":1080,"type":"article-magazine","title":"Did attempted rape ignite Venezuela\'s national protests?","container-title":"Christian Science Monitor","source":"Christian Science Monitor","abstract":"Student protests began at the University of the Andes in San Cristobal, Venezuela, after an attempted rape of a college woman. A week later, the protests boiled over into a violent national uprising.","URL":"http://www.csmonitor.com/World/Latest-News-Wires/2014/0222/Did-attempted-rape-ignite-Venezuela-s-national-protests","ISSN":"0882-7729","author":[{"family":"Sequera","given":"Vivia"}],"issued":{"date-parts":[["2014",2,22]]},"accessed":{"date-parts":[["2014",4,7]]}}}],"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"} }
</div>
<div>
<a title="" href="#_ftnref2">[2]</a> { ADDIN ZOTERO_ITEM CSL_CITATION {"citationID":"4YnaAzSw","properties":{"formattedCitation":"{\\\\rtf Sara Carolina D\\\\uc0\\\\u237{}az, \\\\uc0\\\\u8220{}Sector de La Oposici\\\\uc0\\\\u243{}n Convoca a Marcha Para El 12 de Febrero,\\\\uc0\\\\u8221{} February 2, 2014, http://www.eluniversal.com/nacional-y-politica/140202/sector-de-la-oposicion-convoca-a-marcha-para-el-12-de-febrero.}","plainCitation":"Sara Carolina DÃaz, “Sector de La Oposición Convoca a Marcha Para El 12 de Febrero,†February 2, 2014, http://www.eluniversal.com/nacional-y-politica/140202/sector-de-la-oposicion-convoca-a-marcha-para-el-12-de-febrero."},"citationItems":[{"id":1136,"uris":["http://zotero.org/groups/228165/items/MTSN6T7J"],"uri":["http://zotero.org/groups/228165/items/MTSN6T7J"],"itemData":{"id":1136,"type":"post-weblog","title":"Sector de la oposición convoca a marcha para el 12 de febrero","abstract":"Caracas.- Cientos de personas atendieron el llamado de parte de la dirigencia opositora y de Voluntad Popular en la plaza Brión de ChacaÃto para participar en una asamblea popular con el fin de expresar su opinión sobre la salida posible a la crisis (...)","URL":"http://www.eluniversal.com/nacional-y-politica/140202/sector-de-la-oposicion-convoca-a-marcha-para-el-12-de-febrero","author":[{"family":"DÃaz","given":"Sara Carolina"}],"issued":{"date-parts":[["2014",2,2]]},"accessed":{"date-parts":[["2014",4,7]]}}}],"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"} }
</div>
</div>';
my $regex = qr/\{\s*ADDIN ZOTERO_ITEM.*http\:\/\/zotero\.org\/.*items\/([^\"]*).*\}\s*}/p;
if ( $str =~ /$regex/ ) {
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