3
cb219
3y

Used the java replace method to remove specific characters with a regex. Wondered, why the characters weren't replaced until I realized I forgot that replace doesn't use regex but matches literally. Checked my previous code snippets, whether I made that mistake previously ... nope, I used replaceAll. 🤦

Comments
  • 2
    Those methods are *terribly* named in fairness. Sounds like one just replaces one instance, and the other replaces every instance (which of course, is completely wrong.) I even come across seniors who don't realise one takes a regex and one doesn't.
  • 1
    You are probably victim # 9147299
Add Comment