I wish to replace all instances of a pipe in a specific string with something else. However, not only is it not replacing the specified string but instead replacing all blank spaces. Example:
String cleanTitle = StringEscapeUtils.escapeHtml("Bacon is | good");
out.println(cleanTitle.replaceAll("|", "*"))
This example is outputting *B*a*c*o*n*i*s*|*g*o*o*d*
I need it to say Bacon is * good
-The function escapeHTML is necessary for my interface, despite this example not using it for my question.
You need to escape the pipe in your expression, so use:
See also