I need to do a simple string replace operation on a segment of string. I ran into the following issue and hope to get some advice.
- In the original string I got, I can replace the string such as
<div class="more">
to something else. - BUT, in the same original string, if I want to replace a much long string such as the following, it won’t work. Nothing gets replaced after the call.
<div class="more"><a href="http://SERVER_name/profiles/atom/mv/theboard/entries/related.do?email=xyz.com&amp;ps=20&amp;since=1273518953218&amp;sinceEntryId=abc-def-123-456">More...</a></div>
I tried these two methods:
originalString.replaceFirst(moreTag, newContent);
originalString.replaceAll(moreTag, newContent);
Thanks in advance.