tags:

views:

56

answers:

2

I have a log file, most lines are quoted at first and last character, like:

 "2010-09-09,13:33,"user logoff",0"

What's the ruby regex to remove the head and tail quotation marks? so the result string looks like:

 2010-09-09,13:33,"user logoff",0
+4  A: 
str.gsub /^"|"$/, ''
Squeegy
A: 

Or without regular expressions:

string[1...-1]
Chubas
But he wrote "*most* lines are quoted", so he doesn't always want to strip the first and last characters.
Tim Pietzcker
I see. Then the regexp is the right approach, missed that one.
Chubas