I have a string in that match the substring and append the substring with #tag like #Test#;
String str = 'This is a TesT for reteSt the tEsTing which will confirm that test was not TEsTed perfectly by teSTer';
String str2 = 'test';
return 'This is a #TesT# for re#teSt# the #tEsT#ing which will confirm that #test# was not #TEsT#ed perfectly by #teST#er';
i have tried in many ways iam unable to achieve output; please help
String myString1 = 'This is a TesT for reteSt the tEsTing which will confirm that test was not TEsTed perfectly by teSTer';
String myString2 = 'test';
string replacement='#test#';
string result = myString1.replaceAll('(?i)'+myString2,replacement);
system.debug(result);
iam getting result but it is case insensitive.
thanks for any help.