Jeff Schwab
4/20/2006 2:04:00 PM
Minkoo Seo wrote:
> Hi group.
>
> I'd like to substitute every quotation mark ` with whitespace. But, I
> don't want to substitue "`" which is used for the purpose of
> abbreviation.
That's a backtick. "Quotation mark" usually means either a single quote
(') or double quote (").
> Example>
> I'm not a girl => I'm not a girl
> `Hello world' => Hello world'
Those examples use two different characters: the single quote and the
backtick, or back quote. If you want to handle both, you need to do so
explicitly, e.g:
def strip_opening_ticks(s)
s.gsub(/(^|\s)[`']/, '\1 ')
end
p strip_opening_ticks("I'm not a girl")
p strip_opening_ticks("`Hello world'")