It's not a secret anymore!
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
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://zeroturnaround.com/jrebel/download
 
subject: After adding the regular expression it is removing the "f" and "," character.
 
Similar Threads
what is difference between String[] string1 and String string2[]
New Line Character Marshalling issue
equals()
String Comparison(s)
Regular expression