Sometimes, I have to work with not well formed xml (without root). So I take the first node name (In this case "error") and make up a regex pattern: "</error>$"
The problem is it matches true with the following string. (</error>
is the end of the line)
<error>0</error>
<roles>
<role rid="12" title="User" description="Hello world"></role>
<role rid="11" title="Admin" description="Hello world2"></role></roles>
After looking at some reference I tried to do so </error>\z
and </error>\Z
. but it doesn't work.
Please help me with the solution
P.S. If there are better solution, I'll be really happy. Target environment is javascript.