Question about the String.replaceAll() and String.replaceFirst() method.
- by Java Doe
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 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&ps=20&since=1273518953218&sinceEntryId=abc-def-123-456">More...</a></div>
I tried these two methods:
originalString.replaceFirst(moreTag, newContent);
originalString.replaceAll(moreTag, newContent);
Thanks in advance.