I have several strings that look like this:
\"((String1))\"
They are all different lengths. How could I remove the parentheses from all these s
Using String#gsub with regular expression:
"((String1))".gsub(/^\(+|\)+$/, '') # => "String1" "(((((( parentheses )))".gsub(/^\(+|\)+$/, '') # => " parentheses "
This will remove surrounding parentheses only.
"(((((( This (is) string )))".gsub(/^\(+|\)+$/, '') # => " This (is) string "