How to gsub a sub-string that starts with a particular character or enclosed by particular characters in ruby?
As for example :input is : Prime rates[ U.S. Effective Date: 12/16/2008 ]
I want to gsub the sub-string that is enclosed by two square braces [ and ] and want output like : Prime Rates
How can I do that using ruby regular expression?
Maybe something like:
This will remove anything enclosed in
[]assuming there is no more than one occurrence of such substring.