aspose file tools*
The moose likes Java in General and the fly likes After adding  the regular expression it is removing the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

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

Shaik Riyaz
Greenhorn

Joined: Apr 17, 2008
Posts: 7
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

Joined: Apr 14, 2004
Posts: 10336

Please do not post the same topic in more than one forum.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: After adding the regular expression it is removing the "f" and "," character.
 
Similar Threads
String Comparison(s)
equals()
Regular expression
New Line Character Marshalling issue
what is difference between String[] string1 and String string2[]