[gull] PCRE \w et caractères accentués

felix felix at f-hauri.ch
Wed Feb 15 21:39:10 CET 2012


On Wed, Feb 15, 2012 at 08:57:21PM +0100, felix wrote:
>   man perlunicode

Allez, un 'tite démo (mon terminal est en utf-8):

$ echo -e "Voici un nom comp_osé,\non est déjà l'après-midi! " |
    perl -Mutf8 -npe '
        utf8::decode($_);
        s/([\p{Alphabetic}\p{Mark}\p{DecimalNumber
               }\p{ConnectorPunctuation}\p{latin}]+)/<\1>/xg;
        utf8::encode($_);
    '
<Voici> <un> <nom> <comp_osé>,
<on> <est> <déjà> <l>'<après>-<midi>! 


--
 Félix Hauri  -  <felix at f-hauri.ch>  -  http://www.f-hauri.ch


More information about the gull mailing list