use strict;
my $str = ' "HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.15), see www.w3.org">
<title>02.00: Page 1</title>
<meta charset="utf-8">
<script type="text/javascript">
var pg_csslibs = []; // CSS Libs for this Page
var pg_jslibs = []; // JS Libs for this Page
</script>
<script src="../../global/js/settings.js" id="settingJS" type=
"text/javascript">
</script>
</head>
<body>
<div id="pageContent">
<!-- CONTENT GOES HERE -->
<div id="pageContent">
<div>
<p><a href="pop/02_00_01/02_00_01_pop01.htm" class=
"modal-pop"><strong>Print</strong></a> the Carousel of Progress
Checklist provided below to keep track of your progress
through the <span class="lang" data-term=
"module_name">module</span>. It is important that you read
each page and complete all practice activities in every
<span class="lang" data-term="lesson_name';
my $regex = qr/<div id="pageContent">[\s\S]*<div id="pageContent">/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