[Edinburgh-pm] Dumb regex question

Chris Yocum cyocum at gmail.com
Fri Jun 15 09:18:50 PDT 2012


Hi Guys,

Ok, I need to find all words that have a lower case letter followed by
an upper case one.  I cannot seem to get it to work.  Here is my
attempt.  Note that this must be in Unicode because I have data with
accent marks in it.

my @words = ("díne", "láechreraig", "caínConchobor");

foreach my $word (@words) {
        if($word =~ m/\p{IsLower}(?=\p{IsUpper})/) {
                 print "$word\n";
        }
}

The only word here that should be matched is "caínConchobor" and words
like it.  Right now the regex matches all the words which isn't what I
was expecting.

Thanks,
Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: Digital signature
URL: <http://mail.pm.org/pipermail/edinburgh-pm/attachments/20120615/b24d1799/attachment.bin>


More information about the Edinburgh-pm mailing list