Java Replace Regex not working

This is because replace takes a String; you need to call replaceAll, which does take a regular expression.