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

Re: [FWP] TPJ One-Liner #39



Quoting Peter Haworth (pmh@edison.ioppublishing.com):
> OK then. Try using POSIX character classes once they're available:
>   /\b[:upper:]\w*/

> ...

> "Wow, that's loathsome.

I couldn't agree more.

>                          I really like it."

But here I must disagree. Must we pollute Perl's wondrous regular
expressions with POSIX nastiness? Is it not enough of a transgression of
truth and justice that POSIX standardised a broken and wrongheaded regular
expression syntax, without compounding the error by making Perl sup of this
poison?

I agree that Perl should have a localisation-independant means to match
upper case characters, but it should be wondrously beautiful, in keeping
with Perl's spirit. Making \u and \l be magical inside character classes
should be sufficient, so the above example would be

/\b[\u]\w*/

which has the added benefit of being shorter than the original. It would
also work inside tr///, where the POSIX horror dare not venture.


To avoid making another post, I would just like to point at the person who
regressed back to the original Perl Journal code and say "HA HA!".

-- 
Adam Rice -- wysiwyg@glympton.airtime.co.uk -- Blackburn, Lancashire, England

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