use strict;
my $str = 'This XML file does not appear to have any style information associated with it. The document tree is shown below.
<seqSmartbox xmlns="http://tecson.dev.oilview.de/gateway/xsd" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="http://tecson.dev.oilview.de/gateway/xsd/smartbox.xsd">
<seqHeader>
<indication>Manuelle Abfrage</indication>
<authCode>03B41236A899</authCode>
<devOperator/>
<devLocation/>
<devID>2-852</devID>
<devVersion>V6.02</devVersion>
</seqHeader>
<seqData>
<seqTanks>
<tankNumber>1</tankNumber>
<tankName>Heizöl</tankName>
<seqTankLevel>
<tankLevel>490</tankLevel>
<tankUnit>L</tankUnit>
</seqTankLevel>
<tankPercent>5</tankPercent>
<seqTankSize>
<tankSize>10000</tankSize>
<tankUnit>L</tankUnit>
</seqTankSize>
<seqTankClear>
<tankClearance>9010</tankClearance>
<tankUnit>L</tankUnit>
</seqTankClear>
</seqTanks>
</seqData>
<seqPara>
<para1>30</para1>
<para2>15</para2>
<para4>0</para4>
<para5>5</para5>
<para9>0</para9>
</seqPara>
</seqSmartbox>';
my $regex = qr/Level>(\d+)<\/tank/p;
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