Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: international case insensitive searched with Perl

by CountZero (Bishop)
on Oct 04, 2011 at 05:56 UTC ( #929445=note: print w/ replies, xml ) Need Help??


in reply to international case insensitive searched with Perl

In my Strawberry Perl 5, version 12, subversion 1 (v5.12.1), it works, but only if I use utf8;.

use Modern::Perl; use utf8; my $string = 'LÉGER'; print $string =~ /léger/i ? 'matched' : 'no match';
Prints "matched".

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


Comment on Re: international case insensitive searched with Perl
Select or Download Code
Re^2: international case insensitive searched with Perl
by GrandFather (Cardinal) on Oct 04, 2011 at 06:02 UTC

    In fact it works with 5.10 just using:

    use strict; use warnings; use utf8; my $string = 'LÉGER'; print $string =~ /léger/i ? 'matched' : 'no match';

    Prints:

    matched
    True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-09-17 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (99 votes), past polls