0

Below is my xml and I'm using String.replaceAll function to get only the "Unable to find the data". What regex can I use?

<errors>
    <error>
    <![CDATA[Unable to find data{}. Possible keys are ["A", "B", "C"]. Please verify your xml.]]>
    </error>
</errors>
Alan Moore
  • 73,866
  • 12
  • 100
  • 156
VBR
  • 93
  • 1
  • 11
  • 1
    Do not use regular expressions to parse XML. See http://stackoverflow.com/questions/701166/can-you-provide-some-examples-of-why-it-is-hard-to-parse-xml-and-html-with-a-reg . – VGR Feb 03 '17 at 17:48

1 Answers1

1

using regex for xml is a mistake. You never know where comments or such will be placed in an xml document screwing up your regex. Use an xml parser.

MeBigFatGuy
  • 28,272
  • 7
  • 61
  • 66