[Edinburgh-pm] Dumb regex question

Anthony Randell anthony.randell at gmail.com
Fri Jun 15 09:36:14 PDT 2012


Odd - running this on strawberry perl 5.12 it works fine.

I just get caínConchobor.  What version are you using?



On 15 June 2012 17:18, Chris Yocum <cyocum at gmail.com> wrote:
> 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
>
> _______________________________________________
> Edinburgh-pm mailing list
> Edinburgh-pm at pm.org
> http://mail.pm.org/mailman/listinfo/edinburgh-pm


More information about the Edinburgh-pm mailing list