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
Post a Comment