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

RE: [FWP] TPJ One-Liner #39



> Must we pollute Perl's wondrous regular expressions with POSIX nastiness?

> [...] which has the added benefit of being shorter than the original.

I agree with the sentiment of keeping it short.  However, I'd point out that
if '\u' meant uppercase letters, then by extension, I would expect '\U' to
be non-uppercase letters (and non-letter characters), which would be a bit
confusing.

I'd also recommend, in the spirit of Perl, that TMTOWTDI, and why not just
implement BOTH in Perl - Add the POSIX stuff, AND add \letter codes, when
available, to represent the common stuff.  Then the JAPH folks can still
write terse code, and the people used to the POSIX RE stuff in their other
tools will feel comfortable doing the same thing in Perl.

 - Andy Jacobs

-----Original Message-----
From: owner-fwp@technofile.org [mailto:owner-fwp@technofile.org]On
Behalf Of Adam Rice
Sent: Friday, July 09, 1999 5:37 PM
To: fwp@technofile.org
Subject: 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

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