I am trying to extract contents inside square brackets. So far I have used this, which works, but I was wondering, instead of using this delete function, if I could directly use something in regex.
a = "This is such a great day [cool awesome]"
a[/\[.*?\]/].delete('[]')
source
share