File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple regex question

 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this seems to work pretty good

.replaceAll("\"{2,}", "\""))
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic