Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using String.Replaceall Regex to replace XML Element

807588Jun 16 2009 — edited Jun 16 2009
I was looking at string.replaceall and I saw that it can take in a regex string to replace a value of a string.

I have an element that I want to effectively delete within an xml string. I've tried something like:

result = result.replaceAll("\\A<name>\\z</name>","");

Where \A is supposed to denote the beginning of the input and \z is supposed to denote the end of input, but I think I have something wrong. I have to do it similar to this because I need to delete the data inside the tag as well.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2009
Added on Jun 16 2009
8 comments
2,888 views