ruby - how to remove the " quote from string? -


possible duplicate:
ruby code modifying outer quotes on strings?

this string:

 msgid """we couldn't set account, sorry.  please try again, or contact ""admin (link above)." 

i want remove double quotes except first , last one. how may that?

this assuming strings of "msgid..." format shown above , inteded output 'msgid "text here"':

>> str.gsub(/(msgid )"{1,}(.*) "{1,}(.*)"/, '\1"\2 \3"') => "msgid "we couldn't set account, sorry.  please try again or contact admin (link above)."" >> puts str.gsub(/(msgid )"{1,}(.*) "{1,}(.*)"/, '\1"\2 \3"') msgid "we couldn't set account, sorry.  please try again or contact admin (link above)." 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -