From: Dominic Rose Date: 2010-05-11T03:00:00+09:00 Subject: Re: win32 ruby1.9 regexp and cyrillic string Caleb Clausen wrote: > On 4/27/10, Nikolay Khodyunya wrote: >> #coding: utf-8 >> str2 = "asdfМикимаус" >> p str2.encoding # >> p str2.scan /\p{Cyrillic}/ #found all cyrillic charachters >> str2.gsub!(/\w/u,'') #removes only latin characters >> puts str2 >> >> The question is why /\w/ ignore cyrillic characters? > > I think that \w (and similar shortcuts) is supposed to match ascii > characters only... thus it's equivalent to [a-zA-Z]. > > Isn't there some kind of unicode character class you can use? Actually "asdfМикимаус".gsub!(/\w/u,'') returns "" on linux so the problem is from the windows package. you can use "asdfМикимаус".gsub!(/\p{L}/,'') to remove letters thought -- Posted via http://www.ruby-forum.com/.