I'm trying to figure out how to insert a specific string into another (or create a new one) after a certain string pattern inside the original String.
For example, given this string,
"&2This is the &6String&f."
How would I insert "&l" after all "&x" strings, such that it returns,
"&2&lThis is the &6&lString&f&l."
I tried the following using positive look-behind Regex, but it returned an empty String and I'm not sure why. The "message" variable is passed into the method.
String[] segments = message.split("(?<=&.)");
String newMessage = "";
for (String s : segments){
s.concat("&l");
newMessage.concat(s);
}
System.out.print(newMessage);
Thank you!