This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets 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://aspose.com/file-tools
 
subject: After adding the regular expression it is removing the "f" and "," character.
 
Similar Threads
what is difference between String[] string1 and String string2[]
Regular expression
String Comparison(s)
equals()
New Line Character Marshalling issue