[TxMt] Re: how to match unicode?

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Sep 24 13:57:11 UTC 2008


On 24.09.2008, at 15:01, James Gray wrote:

> On Sep 24, 2008, at 4:08 AM, Piero D'Ancona wrote:
>
>> Writing a ruby command for TextMate to reformat author names
>> in a list of papers I run into the obvious but sad fact that
>> /[A-z]/ =~ "ü"
>> does not match anything.  Is there a simple workaround?
>
> If you set $KCODE = "U" in Ruby 1.8 (or pass the equivalent -KU
> switch) character classes like \w change to the Unicode definition of
> "word" characters:
>
> $ ruby -KU -ve 'p "Résumé"[/\w+/]'
> ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin9.4.0]
> "Résumé"
>
> Hope that helps

Haha. Please believe me, I did exactly the same. And it didn't work.  
But after your mail it works. And to be honestly I do not know why ;)

Thanks,

--Hans


More information about the textmate mailing list