Consider a sample example as below:
String string = "Hi$?Hello$?". In the string object the "$?" is the regex pattern. The first occurrence of the $? has to replaced with "there" and second occurrence of the $? has to replaced with "world".
How to implement the same using Java? or Is there any methods available in Apache commons StringUtils to implement the same?
if all you need is sequential replacement of some placeholder string in search string, you can use Apache StringUtils :
that is provided the sequence is known in advance and placeholder is guarenteed to be present.