[26185] in Perl-Users-Digest
Perl-Users Digest, Issue: 8374 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 31 06:05:26 2005
Date: Wed, 31 Aug 2005 03:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 31 Aug 2005 Volume: 10 Number: 8374
Today's topics:
Re: array question (newbie) <john@castleamber.com>
how to add a space using a regex <g-preston1@ti.com>
Re: how to add a space using a regex <thepoet_nospam@arcor.de>
Re: how to add a space using a regex <john@castleamber.com>
Re: how to add a space using a regex (Anno Siegel)
Re: how to add a space using a regex <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: how to add a space using a regex <john@castleamber.com>
Re: how to add a space using a regex <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: how to add a space using a regex (Anno Siegel)
Re: how to add a space using a regex <flavell@ph.gla.ac.uk>
Is it possible to resize or crop JPG image with Perl? <max@xxxxxxx.xxx>
Re: Is it possible to resize or crop JPG image with Per <simon@unisolve.com.au>
Re: Jargons of Info Tech industry <john@castleamber.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Aug 2005 04:44:55 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: array question (newbie)
Message-Id: <Xns96C2F158BB4CFcastleamber@130.133.1.4>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
> You don't have warnings enabled. Have you read the posting guidelines
> for this group yet?
I was just wondering, if postings that don't follow the posting guidelines
are just ignored, especially by the regulars *and* together with the FAQ
xx.yy (or maybe instead of) a message is posted:
Subject: Why is your message not answered?
With a link to posting guidelines
(and to the FAQ)?
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Wed, 31 Aug 2005 02:01:01 -0500
From: "Jerry Preston" <g-preston1@ti.com>
Subject: how to add a space using a regex
Message-Id: <df3kje$i1j$1@home.itg.ti.com>
What I want to do is add a space between one's name when the are like the
following:
$name1 = "FirstLast:";
I want change $name1 = "First Last";
and
$name1 = "FirstMiddleLast:";
I want change $name1 = "First Middle Last";
To be able to add spaces for either "FirstLast:" or "FirstMiddleLast:" with
the same regex?
Thanks,
Jerry
------------------------------
Date: Wed, 31 Aug 2005 10:05:58 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: how to add a space using a regex
Message-Id: <431564e6$0$2100$9b4e6d93@newsread2.arcor-online.net>
Jerry Preston wrote:
> What I want to do is add a space between one's name when the are like the
> following:
>
> $name1 = "FirstLast:";
>
> I want change $name1 = "First Last";
>
> and
>
> $name1 = "FirstMiddleLast:";
>
> I want change $name1 = "First Middle Last";
>
> To be able to add spaces for either "FirstLast:" or "FirstMiddleLast:" with
> the same regex?
You can use zero width look-behind and look-ahead assertions for
that.
In words:
Look for a place that is preceded by a lower case letter and
followed by an upper case letter and substitute that place with
a space.
Which looks like the following:
$name1 =~ s/(?<=[a-z])(?=[A-Z])/ /g;
But you should have in mind that your method isn't fool proof.
There may be surnames that contain more than one upper case letter
(just ask Tad ;-)).
See "perldoc perlre" for details on zero width assertions.
HTH
-Chris
------------------------------
Date: 31 Aug 2005 08:07:55 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: how to add a space using a regex
Message-Id: <Xns96C31FA4926EFcastleamber@130.133.1.4>
"Jerry Preston" <g-preston1@ti.com> wrote:
> What I want to do is add a space between one's name when the are like
> the following:
>
> $name1 = "FirstLast:";
>
> I want change $name1 = "First Last";
>
> and
>
> $name1 = "FirstMiddleLast:";
>
> I want change $name1 = "First Middle Last";
>
> To be able to add spaces for either "FirstLast:" or "FirstMiddleLast:"
> with the same regex?
s/([a-z])([A-Z])/$1 $2/g;
(Wonders about Old McDonald)
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 31 Aug 2005 08:12:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to add a space using a regex
Message-Id: <df3opr$qgm$1@mamenchi.zrz.TU-Berlin.DE>
Jerry Preston <g-preston1@ti.com> wrote in comp.lang.perl.misc:
> What I want to do is add a space between one's name when the are like the
> following:
>
> $name1 = "FirstLast:";
>
> I want change $name1 = "First Last";
>
> and
>
> $name1 = "FirstMiddleLast:";
>
> I want change $name1 = "First Middle Last";
>
> To be able to add spaces for either "FirstLast:" or "FirstMiddleLast:" with
> the same regex?
A regex doesn't change a string, but a substitution (one part of which
is a regex) does.
Can you insert spaces in either "FirstLast:" or "FirstMiddleLast:" with
the same substitution? That would depend on how you intend to recognize
the parts of the nname. You have said nothing about that.
Here is a substitution that inserts a space whereever a capital
letter immediately follows a lower-case one:
s/([[:lower:]])([[:upper:]])/$1 $2/g;
but that would mis-handle names like "McBarren".
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Wed, 31 Aug 2005 11:16:55 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: how to add a space using a regex
Message-Id: <Xns96C372C42AA46elhber1lidotechnet@62.89.127.66>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> Jerry Preston <g-preston1@ti.com> wrote in comp.lang.perl.misc:
>> What I want to do is add a space between one's name when the are
>> like the following:
>>
>> $name1 = "FirstLast:";
>>
>> I want change $name1 = "First Last";
>>
>> and
>>
>> $name1 = "FirstMiddleLast:";
>>
>> I want change $name1 = "First Middle Last";
>>
>> To be able to add spaces for either "FirstLast:" or
>> "FirstMiddleLast:" with the same regex?
>
> A regex doesn't change a string, but a substitution (one part of
> which is a regex) does.
>
> Can you insert spaces in either "FirstLast:" or "FirstMiddleLast:"
> with the same substitution? That would depend on how you intend
> to recognize the parts of the nname. You have said nothing about
> that.
>
> Here is a substitution that inserts a space whereever a capital
> letter immediately follows a lower-case one:
>
> s/([[:lower:]])([[:upper:]])/$1 $2/g;
>
> but that would mis-handle names like "McBarren".
I suggest that two letter first names are quite rare, which leads to
an obvious adjustment of your regex. Still not perfect, but much
closer.
--
Cheers,
Bernard
------------------------------
Date: 31 Aug 2005 09:28:24 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: how to add a space using a regex
Message-Id: <Xns96C32D28925E8castleamber@130.133.1.4>
"Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> wrote:
> I suggest that two letter first names are quite rare,
Not 2 letter first names, but for example TadMcClellan
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Wed, 31 Aug 2005 11:36:33 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: how to add a space using a regex
Message-Id: <Xns96C376188AEE0elhber1lidotechnet@62.89.127.66>
John Bokma <john@castleamber.com> wrote:
> "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> wrote:
>
>> I suggest that two letter first names are quite rare,
>
> Not 2 letter first names, but for example TadMcClellan
What I mean is, you can safely assume that 2 letter names are too rare
to worry about, so adjusting the s/// to ignore two letter
[:upper:][:lower:] sequences should "fix" it.
--
Cheers,
Bernard
------------------------------
Date: 31 Aug 2005 09:45:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to add a space using a regex
Message-Id: <df3u82$fa$1@mamenchi.zrz.TU-Berlin.DE>
John Bokma <john@castleamber.com> wrote in comp.lang.perl.misc:
> "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> wrote:
>
> > I suggest that two letter first names are quite rare,
>
> Not 2 letter first names, but for example TadMcClellan
How is that an objection?
s/([[:alpha:]][[:lower:]])([[:upper:]])/$1 $2/g;
makes "Tad McClellan" as it should.
Ed, Al, Ty, Bo, Jo, Ma, Lu and Vi would be out of luck.
A US name list (from the Census Bureau) lists 6 male and 27(!) female
two-letter names.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Wed, 31 Aug 2005 10:59:36 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: how to add a space using a regex
Message-Id: <Pine.LNX.4.62.0508311053220.17651@ppepc56.ph.gla.ac.uk>
On Wed, 31 Aug 2005, John Bokma wrote:
> (Wonders about Old McDonald)
Indeed. Then there are surnames like St. John.
This is addressed more to the O.P :-
Handling names is fraught, even if they're all written correctly!
Seems to me that trying to define some other format for writing them
is only going to make a difficult task even more difficult, maybe even
impossible. (I have a local script to deal with the names of members
of staff of the department that I'm in: and it's full of special
cases, and has to be updated several times a year. So I'm not talking
pure theory.)
------------------------------
Date: Wed, 31 Aug 2005 08:44:37 +0200
From: "max" <max@xxxxxxx.xxx>
Subject: Is it possible to resize or crop JPG image with Perl?
Message-Id: <df3jkg$eln$1@ss405.t-com.hr>
Is it possible to resize or crop JPG image with Perl?
How to do it?
Tnx.
------------------------------
Date: Wed, 31 Aug 2005 17:26:44 +1000
From: Simon Taylor <simon@unisolve.com.au>
Subject: Re: Is it possible to resize or crop JPG image with Perl?
Message-Id: <df3ma9$22rv$1@otis.netspace.net.au>
Hello Max,
> Is it possible to resize or crop JPG image with Perl?
> How to do it?
Check out this module at cpan.org:
Image::Resize
and also consider PerlMagick, described here:
http://www.imagemagick.org/script/perl-magick.php
Regards,
Simon Taylor
--
www.perlmeme.org
------------------------------
Date: 31 Aug 2005 04:19:33 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Jargons of Info Tech industry
Message-Id: <Xns96C2ED100F7D9castleamber@130.133.1.4>
Mark McIntyre <markmcintyre@spamcop.net> wrote:
> On 30 Aug 2005 18:06:48 GMT, in comp.lang.c , John Bokma
> <john@castleamber.com> wrote:
>
>>Mark McIntyre <markmcintyre@spamcop.net> wrote:
>>
>>>Its a complete mystery. Just as is the reason why you are x-posting
>>>complete garbage to comp.lang.c...
>>
>>A similar mystery as in why Mark clueless n00b II McIntyre thinks it's
>>a good idea to cross post to all other groups except comp.lang.c?
>
> I see you felt it appropriate to RE-post this offtopic garbage back
> into clc.
>
> You sir, are a troll,
No clueless n00b, you are a troll, or either too stupid to have a Usenet
account.
> and I'd claim my fiver if I could be arsed.
>
> <plonk>
Exactly, you and your clueless buddy think you can make smart ass
statements.
Either add something not brain dead to this thread, or let it go. As I
already explained to that other n00b, threads like this *can't* be
stopped, moved, controlled or what. The harder you try the longer it
takes for it to stop. Either ignore the whole thing, or make a useful
contribution which might make setting the FollowUp-To: header work (but
don't get angry if it's ignored).
Now lets hope that the rest gets the point. Thanks.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8374
***************************************