2
I have an xml that came from a docx in this format:
<w:p w:rsidR="00AE2D8E" w:rsidRPr="00AE2D8E" w:rsidRDefault="00AE2D8E">
<w:pPr>
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00AE2D8E">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t xml:space="preserve">Lorem ipsum dolor sit </w:t>
</w:r>
<w:proofErr w:type="spellStart"/>
<w:r w:rsidRPr="00AE2D8E">
<w:rPr>
<w:b/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>amet</w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
<w:r w:rsidRPr="00AE2D8E">
<w:rPr>
<w:b/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t xml:space="preserve"> </w:t>
</w:r>
<w:proofErr w:type="spellStart"/>
<w:r w:rsidRPr="00AE2D8E">
<w:rPr>
<w:b/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>consecteur</w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
<w:r w:rsidRPr="00AE2D8E">
<w:rPr>
<w:b/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>.</w:t>
</w:r>
<w:bookmarkStart w:id="0" w:name="_GoBack"/>
<w:bookmarkEnd w:id="0"/>
</w:p>
What is written in docx is "Lorem ipsum dolor sit Amet consecteur." but it ends up breaking because of the differences in font, Bold, etc.
The problem is that I need to replace the text "Lorem ipsum dolor sit Amet consecteur." with any other text.
Does anyone know how to do this by regex? Is it possible? If not, what other viable option?
EDIT: So my goal is to replace the text "Lorem ipsum dolor sit Amet consecteur." with another text. The problem is that in the middle of it, on account of docx xml, are created orientation tags of text formatting (, ). The regex I have here is:
\bLorem ipsum dolor sit amet consecteur.\b
This regex ends up not finding the phrase on account of the codes in the middle, the ideal is that it replaced ignoring the codes in the middle.
I don’t understand your doubt, if you edit and explain better I try to help you!
– Marconi
Okay, I edited trying to explain better.
– Juliano
I noticed that the text is fragmented into some tags. I could delete all these tags where there is text and leave only one?
– Sam
Here’s what it would look like: https://jsfiddle.net/n7oLhfk3/
– Sam
I don’t think it’s going to happen, imagine it in a large, multi-part document, I need to replace it in several parts. Explaining in general, I need to translate parts of a docx.
– Juliano
You want to delete the tags and just take the text and replace?
– Sam