String replacing inside a string

str = '------=_Part_175719_978479363.1590456257873

Content-Type: application/xop+xml;charset=UTF-8;type=“text/xml”

Content-Transfer-Encoding: 8bit

Content-ID: <5f70a00f-ea66-42b5-ae8f-59734a91db63>

<?xml version="1.0" encoding="UTF-8" ?>

<env:Envelope xmlns:env=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:wsa=“http://www.w3.org/2005/08/addressing”>env:Headerwsa:Actionhttp://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/getDocumentsForFilePrefixResponse</wsa:Action>wsa:MessageIDurn:uuid:ce8ffa02-adc1-42a4-b5c1-5b9b9eee516d</wsa:MessageID></env:Header>env:Body<ns0:getDocumentsForFilePrefixResponse xmlns:ns0=“http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/”><ns2:result xmlns:ns2=“http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/” xmlns:ns1=“http://xmlns.oracle.com/adf/svc/types/” xmlns:ns0=“http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:type=“ns0:DocumentDetails”>ns0:Content<xop:Include xmlns:xop=“http://www.w3.org/2004/08/xop/include” href=“cid:1f206475-3aac-4f40-a424-98d30fe2719b”/></ns0:Content><ns0:FileName xsi:nil=“true”/><ns0:ContentType xsi:nil=“true”/>ns0:DocumentTitleDMUSMakeRecommendations_202005191230.csv</ns0:DocumentTitle>ns0:DocumentAuthorpln_integration</ns0:DocumentAuthor>ns0:DocumentSecurityGroupFAFusionImportExport</ns0:DocumentSecurityGroup>ns0:DocumentAccountscm$/planningDataLoader$/export$</ns0:DocumentAccount>ns0:DocumentNameDMUSMakeRecommendations_202005191230.csv</ns0:DocumentName>ns0:DocumentId122069</ns0:DocumentId></ns2:result></ns0:getDocumentsForFilePrefixResponse></env:Body></env:Envelope>

------=_Part_175719_978479363.1590456257873

Content-Transfer-Encoding: binary

Content-ID: <8492744a-bf38-40a7-b212-ee5aa5d31670>

ITEM_NAME,DESTINATION_ORG_CODE,UOM_CODE,QUANTITY,WORK_ORDER_START_DATE,WORK_ORDER_COMPLETION_DATE,SUPPLY_OPERATION,WORK_ORDER_NUMBER,WORK_DEFINITION_CODE,WORK_METHOD_CODE_VAL,FIRM_PLANNED_FLAG
101512-01,1210,ea,264,2020-05-11,2020-06-12,CREATE,3443039,PRIMARY,DISCRETE_MANUFACTURING,2

------=_Part_175719_978479363.1590456257873–’

in the above string i want to replace the below content id value
Content-ID: <8492744a-bf38-40a7-b212-ee5aa5d31670>

You probably need gsub:
https://docs.ruby-lang.org/en/2.7.0/String.html#method-i-gsub

2.7.1 :003 > a = "some string to replace parts of"
2.7.1 :004 > a.gsub("replace", "change")
 => "some string to change parts of"

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs