Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: CSV::IllegalFormatError (Need to club data entry person
Sean Clark
7/9/2006 10:19:00 PM
Bira wrote:
> line.gsub(/[^,]"[^,]/,"'")
Bira, I'm testing your idea with the below script but I'm having
problems. Thanks for the start though.
TEST PROGRAM:
line = "\"NAME\",\"610 \"A\" STREET\",\"STATE\",\"POSTAL_CODE\""
puts line
# if double quote not preceeded by a comman and not followed
# by a comma, then replace the quotation with a single quote.
new_line = line.gsub(/[^,]"[^,]/,"'")
puts new_line
OUTPUT:
"NAME","610 "A" STREET","STATE","POSTAL_CODE"
"NAME","610'" STREET","STATE","POSTAL_CODE"
Any ideas regular expression masters?
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: CSV::IllegalFormatError (Need to club data entry person
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password