When I try this code below, it works fine using the regex boundaries:
"word john word".replaceAll("\\bjohn\\b","fill")
Result: "word fill word"
But if I need to search for a word that contains "#" it doesn't work:
"word john# word".replaceAll("\\john#\\b","fill")
Result: "word john# word"
How can I solve it?