Click here to Skip to main content
15,884,738 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<ArticleBackmatter>
   <title>sample </title>
   <Heading>Acknowledgments</Heading>
   <subtitle>sample stitle</subtitle>
   <Heading>Ethical standards and patient consent</Heading>
   <subtitle>sample stitle</subtitle>
   <Heading>Conflict of interest</Heading>
</ArticleBackmatter>;



in this first <Heading> must contain the inner text value (Acknowledgments)
second <Heading> must contain the inner text value (Ethical standards and patient consent)
third <Heading> must contain the inner text value (Conflict of interest)

i write the regex for this but it is not correct for sequence <heading>

my code is

XML
<Heading>(Acknowledgments|Ethic[\w+]consent|Conflict of interest)</Heading>
Posted
Updated 6-Oct-14 20:40pm
v2
Comments
Maciej Los 7-Oct-14 3:03am    
Why Regex? You need to check for nodes Heading.
Member 10242311 8-Oct-14 5:19am    
i need to check the headings in sequence order, but my regex check the heading(inner text) available or not, but i want check they available in sequence or not, can you help me via regex

1 solution

You should never use regex to check the format/sequence/validity of an XML file...
For that there is the XSD...XML Schema Tutorial[^]
 
Share this answer
 
Comments
Richard Deeming 27-Jan-16 14:38pm    
Good answer, but the question is from October 2014. :)
Kornfeld Eliyahu Peter 27-Jan-16 14:39pm    
Ops...All I saw is that it is on the top of the list...
Richard Deeming 27-Jan-16 14:40pm    
I guess the OP might still be waiting for an answer - he posted a new question this afternoon, so he's still around.
Kornfeld Eliyahu Peter 27-Jan-16 14:41pm    
How this question popped to the top after that much time?
Richard Deeming 27-Jan-16 14:47pm    
Your answer is listed as Solution 2, so I guess Solution 1 got deleted recently.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900