use strict;
my $str = '<GetFulfillmentPreviewResponse xmlns="http://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01/">
<GetFulfillmentPreviewResult>
<FulfillmentPreviews>
<member>
<MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
<IsCODCapable>false</IsCODCapable>
<IsFulfillable>true</IsFulfillable>
<ShippingSpeedCategory>Standard</ShippingSpeedCategory>
<UnfulfillablePreviewItems/>
<EstimatedShippingWeight>
<Value>4</Value>
<Unit>POUNDS</Unit>
</EstimatedShippingWeight>
<EstimatedFees>
<member>
<Name>FBAPerUnitFulfillmentFee</Name>
<Amount>
<CurrencyCode>USD</CurrencyCode>
<Value>6.73</Value>
</Amount>
</member>
</EstimatedFees>
<FulfillmentPreviewShipments>
<member>
<LatestShipDate>2019-02-02T07:59:59Z</LatestShipDate>
<LatestArrivalDate>2019-02-05T07:59:59Z</LatestArrivalDate>
<FulfillmentPreviewItems>
<member>
<ShippingWeightCalculationMethod>Dimensional</ShippingWeightCalculationMethod>
<SellerFulfillmentOrderItemId>001test</SellerFulfillmentOrderItemId>
<EstimatedShippingWeight>
<Value>3.228</Value>
<Unit>POUNDS</Unit>
</EstimatedShippingWeight>
<Quantity>1</Quantity>
<SellerSKU>ASICS by Rakuten_20180926_29.86_6799</SellerSKU>
</member>
</FulfillmentPreviewItems>
<EarliestArrivalDate>2019-02-04T08:00:00Z</EarliestArrivalDate>
<EarliestShipDate>2019-01-29T08:00:00Z</EarliestShipDate>
</member>
</FulfillmentPreviewShipments>
</member>
</FulfillmentPreviews>
</GetFulfillmentPreviewResult>
<ResponseMetadata>
<RequestId>8a6d2844-317a-4bc7-9183-e405128203d9</RequestId>
</ResponseMetadata>
</GetFulfillmentPreviewResponse>
';
my $regex = qr/\s*<GetFulfillmentPreviewResponse[\s\S]*?>[\s\S]*?<GetFulfillmentPreviewResult[\s\S]*?>[\s\S]*?<FulfillmentPreviews[\s\S]*?<EstimatedFees[\s\S]*?<Value>([\s\S]*?)<\/Value>/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