Match all occurance of double quotes in a string

P

Patrick Spence

I have a string something like this...
"Now is the time for all good men to blah, blah..." - Origin unknown

I want to convert it to this...
Now is the time for all good men to blah, blah... - Origin
unknown

With the first double quote converted to "" and the second to "".
The occurance of the 1st double quote may or may not be at the beginning
of the string.
 
A

Alex Young

Patrick said:
I have a string something like this...
"Now is the time for all good men to blah, blah..." - Origin unknown

I want to convert it to this...
Now is the time for all good men to blah, blah... - Origin
unknown

With the first double quote converted to "" and the second to "".
The occurance of the 1st double quote may or may not be at the beginning
of the string.
Rather simplistic, but should work:

string.sub(/"([^"]*)"/, '\1')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,085
Members
48,773
Latest member
Kaybee

Latest Threads

Top