File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Simple regex question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple regex question" Watch "Simple regex question" New topic
Author

Simple regex question

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

Hi again coders

I was wondering how I replace an arbitrary number of quotes in a string with only one quote

Ignoring the surrounding " "

I want

"""""elephant""" to become "elephant"
""""elephant"""""" to become "elephant"

etc


Jesus lives
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

this seems to work pretty good

.replaceAll("\"{2,}", "\""))
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple regex question
 
Similar Threads
Great Quotes
Favorite animal in the zoo
Drivel
derived class reference cannot point to an object of base class
Stupid Elephant Jokes