The same error comes when the regex is “+”
Here is the solution.
Enclose your * and + within square brackets.
Here is my code.
public static final String [] wildCards={"[*]","%","@","&","[+]"};
public static void main(String[] args) { String s="!@#$%^&*()";
s=stripWild(s, wildCards); System.out.println(s); }