re = /.*?<AddressLine>([^<]+)<\/AddressLine>.*/
str = '<ymaps xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd http://maps.yandex.ru/ymaps/1.x https://maps.yandex.ru/schemas/ymaps/1.x/ymaps.xsd http://maps.yandex.ru/geocoder/1.x http://maps.yandex.ru/schemas/geocoder/1.x/geocoder.xsd http://maps.yandex.ru/address/1.x http://maps.yandex.ru/schemas/search/1.x/address.xsd urn:oasis:names:tc:ciq:xsdschema:xAL:2.0 http://docs.oasis-open.org/election/external/xAL.xsd">
<GeoObjectCollection>
<metaDataProperty xmlns="http://www.opengis.net/gml">
<GeocoderResponseMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">
<request>56.751574,2038.573856</request>
<found>3</found>
<results>10</results>
</GeocoderResponseMetaData>
</metaDataProperty>
<featureMember xmlns="http://www.opengis.net/gml">
<GeoObject xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" gml:id="1">
<metaDataProperty xmlns="http://www.opengis.net/gml">
<GeocoderMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">
<kind>house</kind>
<text>Турция, Сакарья, Хендек, Ени, улица 2038, 56</text>
<precision>exact</precision>
<Address xmlns="http://maps.yandex.ru/address/1.x">
<country_code>TR</country_code>
<formatted>Турция, Сакарья, Хендек, Ени, улица 2038, 56</formatted>
<Component>
<kind>country</kind>
<name>Турция</name>
</Component>
<Component>
<kind>province</kind>
<name>Сакарья</name>
</Component>
<Component>
<kind>area</kind>
<name>Хендек</name>
</Component>
<Component>
<kind>district</kind>
<name>Ени</name>
</Component>
<Component>
<kind>street</kind>
<name>улица 2038</name>
</Component>
<Component>
<kind>house</kind>
<name>56</name>
</Component>
</Address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<AddressLine>Турция, Сакарья, Хендек, Ени, улица 2038, 56</AddressLine>
<CountryNameCode>TR</CountryNameCode>
<CountryName>Турция</CountryName>
<AdministrativeArea>
<AdministrativeAreaName>Сакарья</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Хендек</SubAdministrativeAreaName>
<Locality>
<DependentLocality>
<DependentLocalityName>Ени</DependentLocalityName>
<Thoroughfare>
<ThoroughfareName>улица 2038</ThoroughfareName>
<Premise>
<PremiseNumber>56</PremiseNumber>
</Premise>
</Thoroughfare>
</DependentLocality>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
</GeocoderMetaData>
</metaDataProperty>
<description xmlns="http://www.opengis.net/gml">Ени, Хендек, Сакарья, Турция</description>
<name xmlns="http://www.opengis.net/gml">улица 2038, 56</name>
<boundedBy xmlns="http://www.opengis.net/gml">
<Envelope>
<lowerCorner>30.728833 40.789485</lowerCorner>
<upperCorner>30.737043 40.795725</upperCorner>
</Envelope>
</boundedBy>
<Point xmlns="http://www.opengis.net/gml">
<pos>30.732938 40.792605</pos>
</Point>
</GeoObject>
</featureMember>
<featureMember xmlns="http://www.opengis.net/gml">
<GeoObject xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" gml:id="2">
<metaDataProperty xmlns="http://www.opengis.net/gml">
<GeocoderMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">
<kind>house</kind>
<text>Турция, Денизли, Памуккале, Джанкуртаран, улица 2038, 56</text>
<precision>exact</precision>
<Address xmlns="http://maps.yandex.ru/address/1.x">
<country_code>TR</country_code>
<formatted>Турция, Денизли, Памуккале, Джанкуртаран, улица 2038, 56</formatted>
<Component>
<kind>country</kind>
<name>Турция</name>
</Component>
<Component>
<kind>province</kind>
<name>Денизли</name>
</Component>
<Component>
<kind>area</kind>
<name>Памуккале</name>
</Component>
<Component>
<kind>district</kind>
<name>Джанкуртаран</name>
</Component>
<Component>
<kind>street</kind>
<name>улица 2038</name>
</Component>
<Component>
<kind>house</kind>
<name>56</name>
</Component>
</Address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<AddressLine>Турция, Денизли, Памуккале, Джанкуртаран, улица 2038, 56</AddressLine>
<CountryNameCode>TR</CountryNameCode>
<CountryName>Турция</CountryName>
<AdministrativeArea>
<AdministrativeAreaName>Денизли</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Памуккале</SubAdministrativeAreaName>
<Locality>
<DependentLocality>
<DependentLocalityName>Джанкуртаран</DependentLocalityName>
<Thoroughfare>
<ThoroughfareName>улица 2038</ThoroughfareName>
<Premise>
<PremiseNumber>56</PremiseNumber>
</Premise>
</Thoroughfare>
</DependentLocality>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
</GeocoderMetaData>
</metaDataProperty>
<description xmlns="http://www.opengis.net/gml">Джанкуртаран, Памуккале, Денизли, Турция</description>
<name xmlns="http://www.opengis.net/gml">улица 2038, 56</name>
<boundedBy xmlns="http://www.opengis.net/gml">
<Envelope>
<lowerCorner>29.218953 37.67848</lowerCorner>
<upperCorner>29.227164 37.685006</upperCorner>
</Envelope>
</boundedBy>
<Point xmlns="http://www.opengis.net/gml">
<pos>29.223059 37.681743</pos>
</Point>
</GeoObject>
</featureMember>
<featureMember xmlns="http://www.opengis.net/gml">
<GeoObject xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" gml:id="3">
<metaDataProperty xmlns="http://www.opengis.net/gml">
<GeocoderMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">
<kind>house</kind>
<text>Турция, Адыяман, Адыяман Меркез, Сителер, улица 2038, 54</text>
<precision>near</precision>
<Address xmlns="http://maps.yandex.ru/address/1.x">
<country_code>TR</country_code>
<formatted>Турция, Адыяман, Адыяман Меркез, Сителер, улица 2038, 54</formatted>
<Component>
<kind>country</kind>
<name>Турция</name>
</Component>
<Component>
<kind>province</kind>
<name>Адыяман</name>
</Component>
<Component>
<kind>area</kind>
<name>Адыяман Меркез</name>
</Component>
<Component>
<kind>district</kind>
<name>Сителер</name>
</Component>
<Component>
<kind>street</kind>
<name>улица 2038</name>
</Component>
<Component>
<kind>house</kind>
<name>54</name>
</Component>
</Address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<AddressLine>Турция, Адыяман, Адыяман Меркез, Сителер, улица 2038, 54</AddressLine>
<CountryNameCode>TR</CountryNameCode>
<CountryName>Турция</CountryName>
<AdministrativeArea>
<AdministrativeAreaName>Адыяман</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Адыяман Меркез</SubAdministrativeAreaName>
<Locality>
<DependentLocality>
<DependentLocalityName>Сителер</DependentLocalityName>
<Thoroughfare>
<ThoroughfareName>улица 2038</ThoroughfareName>
<Premise>
<PremiseNumber>54</PremiseNumber>
</Premise>
</Thoroughfare>
</DependentLocality>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
</GeocoderMetaData>
</metaDataProperty>
<description xmlns="http://www.opengis.net/gml">Сителер, Адыяман Меркез, Адыяман, Турция</description>
<name xmlns="http://www.opengis.net/gml">улица 2038, 54</name>
<boundedBy xmlns="http://www.opengis.net/gml">
<Envelope>
<lowerCorner>38.291327 37.766104</lowerCorner>
<upperCorner>38.299537 37.772622</upperCorner>
</Envelope>
</boundedBy>
<Point xmlns="http://www.opengis.net/gml">
<pos>38.295432 37.769363</pos>
</Point>
</GeoObject>
</featureMember>
</GeoObjectCollection>
</ymaps>'
subst = '$1'
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
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