Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You say "don't ask me why", but I'm afraid I'm going to invoke programmer's prerogative and ask you why. If nothing else, because the solution will vary based on what the actual problem is. So for example, even using regexes, if you take misha's example (assuming it's fixed up to process the whitespace between the elements properly), it will only work on <em>exactly</em> the XML you posted. </p> <p>In other words, with XML like this:</p> <pre><code>&lt;name&gt;AAA&lt;/name&gt; &lt;id&gt;1234&lt;/id&gt; </code></pre> <p>the match would fail. </p> <p>The purpose of XML is to allow for generic processing of this kind of data. Now sure, you can fix up the regex to make sure it deals with a missing gender tag, but if your real-world case is even a little more complex than your example, you will end up with a very complex regex indeed, and the responsibility for ensuring it performs well will fall on you. (Good quality modern XML parsers are highly tuned for good performance.)</p> <p>So there you have it: to answer your question properly, we need to know the actual problem, and in this context, a constraint such as "you must use regexes" is quite interesting. </p> <p>Say for example, that the XML in question isn't actually well-formed XML, so an XML parser would fall at the first hurdle. Knowing this would allow us to question whether the problem could be broken down into simpler parts, such as first extracting a well-formed XML fragment. </p> <p>There could be other reasons, but whatever the reason is, it is crucial to the solution. Please share.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload