Cant figure out this Reg. Expression
Posted: Thu Jan 26, 2006 12:17 am
I dont know if this is possible or not but it would make my life 1000 times easier if it was.
I have XML that looks like this:
<book>
<title>some title</title>
<chapter/>
</book>
Basically I need to erase entire book chunks whose chapter nodes are empty. I'm not a programmer otherwise im sure I could write java to do this in two seconds.
I was playing around with the regexp find/replace in Oxygen and the best I can do is match the entire <title>some title</title> line with the following expression: <title>.+<title> But what I need is to match that entire chunk above. I tried things like <book>\S+<title>.+</title>\S+<chapter/>\S+</book> wont work. even <book>[\t\n\r\f\v]*<title> etc..
Does anyone know how to accomplish this?
Thanks for your help!
I have XML that looks like this:
<book>
<title>some title</title>
<chapter/>
</book>
Basically I need to erase entire book chunks whose chapter nodes are empty. I'm not a programmer otherwise im sure I could write java to do this in two seconds.
I was playing around with the regexp find/replace in Oxygen and the best I can do is match the entire <title>some title</title> line with the following expression: <title>.+<title> But what I need is to match that entire chunk above. I tried things like <book>\S+<title>.+</title>\S+<chapter/>\S+</book> wont work. even <book>[\t\n\r\f\v]*<title> etc..
Does anyone know how to accomplish this?
Thanks for your help!