Skip to content

Instantly share code, notes, and snippets.

@gerep
Created July 21, 2016 19:52
Show Gist options
  • Save gerep/d33945a0914da3c42f5c13cc2d9e5c77 to your computer and use it in GitHub Desktop.
Save gerep/d33945a0914da3c42f5c13cc2d9e5c77 to your computer and use it in GitHub Desktop.
x = "[[1,2,[3]],4]"
x.gsub!(/[\[\]]/,'') # Remove the [ and ] from the string. It is required to escape the [ and ] characters
puts x.split(",") # Join the string making it an array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment