I need a RegEx expression to find the text between two XML tags.
I have tried the following expressions:
The issue is that the entire XML file is being 'matched' which is why I need something in between the tags to stop the RegEx from going past the first </w:p> it encounters.Code:/<w:p[^Pr][^>]*>(([^(<w:p>)])|([^(<w:p>)]))*<\/w:p>/ /<w:p[^Pr][^>]*>[^<\/w:p>]*<\/w:p>/
An example of the XML file is as follows:
What I want to match is the pairs of w:p tags. In the above example there should be 3 matches. The output I want is the following:Life is Good.
<w:p>
<w:pPr>
<w:b />
Random text here.
</w:pPr>
Okay...
</w:p>
More text.
Yo..
<w:p src=".." href=".." style="..">Yoyo</w:p>
<w:p src=".." href=".." style=".."/>Yoyo2</w:p>
Can anyone offer some guidance/advice?Match 1:
<w:p>
<w:pPr>
<w:b />
Random text here.
</w:pPr>
Okay...
</w:p>
Match 2:
<w:p src=".." href=".." style="..">Yoyo</w:p>
Match 3:
<w:p src=".." href=".." style=".."/>Yoyo2</w:p>




Reply With Quote
