[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] TPJ One-Liner #39



On Fri, Jul 09, 1999 at 04:51:05PM +0100, Peter Haworth wrote:
> Ronald J Kimball cleverly spotted my stupid mistake:
> > On Fri, Jul 09, 1999 at 01:43:30PM +0100, Peter Haworth wrote:
> > >
> > > If you want to internationalize (or at least localize) the regexp,
> > > can't you do this?
> > >   /\b\w(?<![\d_])\w*/
> > >
> > > I can't test that because my perl isn't recent enough, so how about this?
> > >   /\b(?![\d_])\w+/
> > > Note + instead of *
> > >
> >
> > Which is the part that makes it only match uppercase letters?  ;)
>
> Oops!
>
> OK then. Try using POSIX character classes once they're available:
>   /\b[:upper:]\w*/
>
 
Abigail once asked in clpmisc for a way to match uppercase characters in
the current locale.  I suggested:
 
$uc = '[^' . quotemeta(lc join('', map {chr} 0x00 .. 0xFF)) . ']';
 
$string =~ /$uc/;
 
Then Abigail said she actually wanted an elegant method.  :)


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe