Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7183979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:06:22+00:00 2026-05-28T18:06:22+00:00

I have an xml file that looks like this: … <e1> <e2> <e3>content1.1</e3> <e3>content1.2</e3>

  • 0

I have an xml file that looks like this:

...
<e1>
   <e2>
      <e3>content1.1</e3>
      <e3>content1.2</e3>
      ...
      <e3>content1.n</e3>
   </e2>
   <e2>
      <e3>content2.1</e3>
      <e3>content2.2</e3>
      ...
      <e3>content2.n</e3>
   </e2>
   ...
</e1>
...

I need a regex that given the xml string (a bunch of e1 elements), would match the all e2 elements that have a child e3 element with content contentx. In other words, the regex would match all e2 elements (could have different e1 parents) where each of these elements has at least one e3 child who’s contents equal contentx.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:06:23+00:00Added an answer on May 28, 2026 at 6:06 pm

    Don’t use a regex to parse XML. Just don’t do it. This is precisely the sort of thing that XPath was made to do. I would offer an XPath expression, but I’m not completely sure what you are trying to match.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

--edited for clarity (hopefully) I have an XML file that looks something like this:
I have an eclipse's .classpath file that looks like this: <?xml version=1.0 encoding=UTF-8?> <classpath>
I have an XML file that looks like this. <collections id=my collections> <category id=my
I have an xml file that looks like this; <Employee> <EmployeeName>Burt Reynolds</EmployeeName> <EmployeeTitle>Bad Ass</EmployeeTitle>
I have a sample xml file that looks like this: <Books> <Category Genre=Fiction BookName=book_name
I have an xml mapping file that looks something like this <colourMappings> <model name=modelX>
I have an XML file that looks like this <library> <book> <title>Title</title> <author>author</author> <price>20</price>
I have an XML file that looks like this. <Almond> Roasted Almonds,Almond Extract,Almond Sauce,Almond
I have an xml file (loaded in with URLLoader) that looks like this: <?xml
I have a XML file that looks like this <Licence> <Name>Test company</Name> <Version>1.1.1.1</Version> <NumberOfServer>2</NumberOfServer>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.