I want to remove Control Characters from a file which is in the form of a string
I have a code but that is showing errors while executing

// The pattern matches control characters
Pattern p = Pattern.compile("{cntrl}");
Matcher m = p.matcher("");
m.reset(NmlFile);

//Replaces control characters with an empty string.
String result = m.replaceAll("");

where 'NmlFile' is the input file which is a string. Here the error is coming from the first line ie from 'compile("{cntrl}")' field. Please help.