I am trying to use gsub to replace "?" and "." with empty space.
I realize that is a difference between gsub(".", "") and gsub(/./, ""), but I don’t know what it is. Can Someone explain?
Also, gsub("?","") seems to work, and gsub(/?/,"") doesn’t work.
How can we make gsub(/?/,"") work?
Finally as it mentioned above
/reg/represents regexp when"str"represents just a string. Your aim is to remove?and.from a string. Regexp will do the job:You can read more about ruby regexp here. In my example
/[abc]/will match single characteraorborc.