Bookmark Topic Watch Topic
  • New Topic

After adding the regular expression it is removing the "f" and "," character.

 
Shaik Riyaz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Report post to moderator
Whenever I am trying to replace all the character rather than ASCII and some characters which are including in ASCII it is removing only letter "f" and comma character from the variable.Can anyone let me know why this is happening?Please find my code as below:

public static String formatString() {
String st="!@#$%^&*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.";
String temp = Normalizer.normalize(st, Normalizer.DECOMP, 0);
String string1=temp.replaceAll("[^\\p{ASCII}]","");
String string2=string1.replaceAll("[\\x01-\\x08,\\x0b-\\x0c,\\x0e-\x1f,\\x7f-\\xffff]", "");
return string2;

}
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same topic in more than one forum.
 
    Bookmark Topic Watch Topic
  • New Topic