File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to remove \ from a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to remove \ from a String" Watch "How to remove \ from a String" New topic
Author

How to remove \ from a String

Qarabagi Jaan
Greenhorn

Joined: May 03, 2004
Posts: 7
Hi,
How to remove \ from a String.
I used
But I got java.util.regex.PatternSyntaxException.
Thanks in advance
Qarabagi
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You need to add two more slashes in the first String. The pattern is sent to another class before it is processed, so you need to make sure you have enough escapes.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
This works for me:



Or according to Keith



Or the simple form



[ October 03, 2006: Message edited by: Edwin Dalorzo ]
[ October 03, 2006: Message edited by: Edwin Dalorzo ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Not exactly what I'd call "advanced".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to remove \ from a String