re = /\s*<GetFulfillmentPreviewResponse[\s\S]*?>[\s\S]*?<GetFulfillmentPreviewResult[\s\S]*?>[\s\S]*?<FulfillmentPreviews[\s\S]*?<EstimatedFees[\s\S]*?<Value>([\s\S]*?)<\/Value>/m
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>
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html