[23993] in Perl-Users-Digest
Perl-Users Digest, Issue: 6194 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 29 11:05:41 2004
Date: Sun, 29 Feb 2004 08:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 29 Feb 2004 Volume: 10 Number: 6194
Today's topics:
CASHITS,COM-WHAT A SCAM <scam@scam.net>
EOL Anchor under Windows <arifi@tnn.net>
Re: EOL Anchor under Windows <noreply@gunnar.cc>
Re: EOL Anchor under Windows <tadmc@augustmail.com>
Re: EOL Anchor under Windows <jeffplus@comcast.net>
Re: GDBM_File under Win32 <zap00217@nifty.com>
Re: GDBM_File under Win32 <zap00217@nifty.com>
Re: how to cut a text file in perl <beable+unsenet@beable.com.invalid>
Re: How to send cookie and redirect in a cgi script? <noreply@gunnar.cc>
Re: LWP User Agent/HTTP Request help needed! <tadmc@augustmail.com>
Perl::API2 PDF problem. (michael vernersen)
Re: reading output file data as input data <tadmc@augustmail.com>
Re: reading output file data as input data <beable+unsenet@beable.com.invalid>
Re: reading output file data as input data (Stephen Moon)
Re: reading output file data as input data <kuujinbo@hotmail.com>
Re: reading output file data as input data <tadmc@augustmail.com>
Re: Regex help needed for complicated mass renaming <stevenv@operamail.com>
regex <yamini_rajan@nospam.com>
Re: regex <gnari@simnet.is>
Re: regex <tadmc@augustmail.com>
Re: regex <mr@sandman.net>
regular expression to capture invalid emails <anonymous@anon.com>
Re: regular expression to capture invalid emails (Sam Holden)
Re: regular expression to capture invalid emails <anonymous@anon.com>
Re: regular expression to capture invalid emails <matthew.garrish@sympatico.ca>
Re: regular expression to capture invalid emails (Sam Holden)
Re: regular expression to capture invalid emails <anonymous@anon.com>
Re: regular expression to capture invalid emails <gnari@simnet.is>
using perl script to compile java (David)
Re: using perl script to compile java <tadmc@augustmail.com>
Re: XML best practices (was: Python as replacement for <dingbat@codesmiths.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 29 Feb 2004 22:33:52 +0800
From: "scam" <scam@scam.net>
Subject: CASHITS,COM-WHAT A SCAM
Message-Id: <4041f8b8$1@newsgate.hknet.com>
PLEASE NOTE THAT WWW.CASHITS.COM IS A SCAM
WHEN SOMEONE UPGRADE TO PAID MEMBER, THEY WILL SUSPEND THEIR ACCOUNT BY
USING VARIOUS TECHNIQUE(ACCUSED YOU SPAM, BOUNCE BACK E-MAIL, NON COMPLIANCE
WITH THEIR RULES SUCH AS BREAK FRAME ETC EVEN YOU HAD DONE NOTHING)
THEY THEN EAT YOUR MONEY AND MEVER PAID YOU ANY PENNY
PLEASE NOTE SERIOUSLY
Indeed, Web sites that loudly clamour:
"Make $3,000+ a MONTH in under an HOUR a day"
should be held to higher standards than those
who believe them.
What we need is a Royal Commission to look
into this. They will need research assistants,
lawyers, and sundry such pen-pushers and
quill-shovers.
------------------------------
Date: Sun, 29 Feb 2004 16:05:37 +0200
From: "Arifi Koseoglu" <arifi@tnn.net>
Subject: EOL Anchor under Windows
Message-Id: <c1srjo$1ip48q$1@ID-213322.news.uni-berlin.de>
Hello people,
Could someone please tell me whether:
1. The $ end-of-line anchor behaves differently in the MS Windows
environment
2. The $ end-of-line anchor does not work in the MS Windows environment
3. I am an ignorant idiot and do not know how to use the $ anchor.
Environment: W2K + cygwin
What is
grep --extended-regexp --ignore-case '[[:punct:]]{1}[[:alnum:]]{3}$'
supposed to match?
TIA,
-arifi
------------------------------
Date: Sun, 29 Feb 2004 15:16:29 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: EOL Anchor under Windows
Message-Id: <c1ssv2$1l9tnh$1@ID-184292.news.uni-berlin.de>
Arifi Koseoglu wrote:
> Could someone please tell me whether:
>
> 1. The $ end-of-line anchor behaves differently in the MS Windows
> environment
> 2. The $ end-of-line anchor does not work in the MS Windows environment
> 3. I am an ignorant idiot and do not know how to use the $ anchor.
It would be suitable if you let us know which programming language you
are referring to, and showed us the code that made you ask that
question. If you don't, I personally tend to believe that 3. is true
and will keep being true.
> Environment: W2K + cygwin
>
> What is
>
> grep --extended-regexp --ignore-case '[[:punct:]]{1}[[:alnum:]]{3}$'
>
> supposed to match?
How about deciding which language you are dealing with and post your
question to an appropriate newsgroup for that language only.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 29 Feb 2004 09:00:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: EOL Anchor under Windows
Message-Id: <slrnc43vl5.hgn.tadmc@magna.augustmail.com>
Arifi Koseoglu <arifi@tnn.net> wrote:
> What is
>
> grep --extended-regexp --ignore-case '[[:punct:]]{1}[[:alnum:]]{3}$'
>
> supposed to match?
What is your Perl question?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 29 Feb 2004 10:18:59 -0500
From: Jeff Schwab <jeffplus@comcast.net>
Subject: Re: EOL Anchor under Windows
Message-Id: <R5adnSG33dkant_dRVn-jg@comcast.com>
Arifi Koseoglu wrote:
> Hello people,
>
> Could someone please tell me whether:
>
> 1. The $ end-of-line anchor behaves differently in the MS Windows
> environment
> 2. The $ end-of-line anchor does not work in the MS Windows environment
> 3. I am an ignorant idiot and do not know how to use the $ anchor.
I assume you are talking about vim.
1) Make sure you compiled vim to recognize CR-LF line termination.
2) :set list
3) :set listchars=eol:$
> Environment: W2K + cygwin
>
> What is
>
> grep --extended-regexp --ignore-case '[[:punct:]]{1}[[:alnum:]]{3}$'
>
> supposed to match?
One character of punctuation, followed by three alphanumeric characters.
The meanings of the named character classes depend on locale and encoding.
------------------------------
Date: Sun, 29 Feb 2004 05:25:29 -0600
From: "kipp" <zap00217@nifty.com>
Subject: Re: GDBM_File under Win32
Message-Id: <3a1f930cfeb64a34a2ef9ee463348e42@localhost.talkaboutprogramming.com>
> Hi,
> I am trying to install GDBM_File on Perl 5.8.0 build 806
> for Win32 from Activestate.
> Under PPM, I added Dave Roth's repository
> (http://www.roth.net/perl/packages).
> But when I launch the PPM command 'install GDBM_File",
> I get the following error message :
> Error: no suitable installation target found for package
> GDBM_File.
I made a GDBM_File ppm package for ActivePerl build 8xx and put it on my web page,
http://homepage2.nifty.com/kipp/perl/packages/5.8/.
You can get it from there and enjoy it.
Kipp
------------------------------
Date: Sun, 29 Feb 2004 05:26:29 -0600
From: "kipp" <zap00217@nifty.com>
Subject: Re: GDBM_File under Win32
Message-Id: <a9e5bcbb07344bf540ed2740a59760df@localhost.talkaboutprogramming.com>
> Hi,
> I am trying to install GDBM_File on Perl 5.8.0 build 806
> for Win32 from Activestate.
> Under PPM, I added Dave Roth's repository
> (http://www.roth.net/perl/packages).
> But when I launch the PPM command 'install GDBM_File",
> I get the following error message :
> Error: no suitable installation target found for package
> GDBM_File.
I made a GDBM_File ppm package for ActivePerl build 8xx and put it on my web page,
http://homepage2.nifty.com/kipp/perl/packages/5.8/.
You can get it from there and enjoy it.
Kipp
------------------------------
Date: Sat, 28 Feb 2004 23:37:47 GMT
From: Beable van Polasm <beable+unsenet@beable.com.invalid>
Subject: Re: how to cut a text file in perl
Message-Id: <33vflq22vd.fsf@dingo.beable.com>
jcharth@hotmail.com (Joseph) writes:
> hi i have a log file that it is increasing to big, how can i keep
> this file of a certain size, in other words, how can i make sure
> that the file is only 200 lines long and delete the first lines if
> longer. i think it would be easier to write this in a shell
> script. but i have no idea in perl. can anyone tell me how to print
> the last 200 lines of a file and overwrite the ssame file. thanks.
Here is a Perl program which will write to a logfile, and not let
it get bigger than 200 lines. Of course, there are lots of other
ways to do it.
#!/usr/bin/perl
use strict;
use warnings;
use Tie::File;
run();
sub run
{
# open logfile
# please read "perldoc Tie::File"
my $logfile = "logfile.txt";
my @logarray = ();
tie @logarray, "Tie::File", $logfile or die "couldn't tie to $logfile: $!";
while(rand(100) > 1)
{
# do something
print("LA LA LA!\n");
# pass a reference to the logarray to logmsg()
# see "perldoc perlreftut" and "perldoc perlref"
logmsg(\@logarray, "I did something!");
}
# untie array when finished
untie @logarray;
}
sub logmsg
{
my $logarrayref = shift;
my $msg = shift;
my $log = time . ": " . $msg;
# write to logfile
# see "perldoc -f push", and "perldoc perlreftut"
push @{$logarrayref}, $log;
# cut the logfile down to 200 lines if necessary.
while(scalar(@{$logarrayref}) > 200)
{
# see "perldoc -f shift", "perldoc perlref", and "perldoc perlfunc"
shift @{$logarrayref};
}
}
__END__
--
------------------------------
Date: Sun, 29 Feb 2004 00:32:50 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to send cookie and redirect in a cgi script?
Message-Id: <c1r92m$1lhuac$1@ID-184292.news.uni-berlin.de>
Alan J. Flavell wrote:
> On Fri, 27 Feb 2004, Gunnar Hjalmarsson wrote:
>> IMNSHO, this is yet another example of CGI.pm unnecessarily
>> abstracting trivial things, and it's remarkable, to say the
>> least, that you're not able to figure it out by help of the
>> 3,400+ lines POD.
>
> There's a long-standing problem here. The author maintains the
> CGI.pm documentation as a rather useful HTML file, which
> accompanies his version of the module.
Since CGI.pm is not just any CPAN module, but included since several
years in the Perl distribution, it's reasonable to expect that its POD
explains the available methods and functions, i.e. that it complies
with perlmodstyle's basic rules for module design. Before your reply
in this thread, I really thought that was the case. I thought that the
other document should be regarded as a user guide.
I still think that's how it should be.
> The Perl porters distribute their core version of CGI.pm (just as
> they do with other core modules) with POD-format documentation -
> which then can be optionally HTML-ified within their installation
> script.
>
> Unfortunately, these two versions of the documentation are not very
> consistent with each other. The POD documentation is quite old,
> and tends to lag behind the changes to the code.
Now you are telling us that the POD is outdated, and that the other
document contains the maintained documentation. Well, if that's the
case, it would be much better IMO - at least short-term - if the POD
was completely dropped and replaced with a note that called the users'
attention to the other document.
As it is now, and if I didn't miss it, the POD does not even include a
reference to the other documentation!
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 28 Feb 2004 17:13:06 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: LWP User Agent/HTTP Request help needed!
Message-Id: <slrnc42842.6on.tadmc@magna.augustmail.com>
Bumble <bumble@what.the.heck> wrote:
> Can I do a search of the my
> $response variable somehow and then just store the bit I need?
$response->content() =~ /something/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 29 Feb 2004 02:22:50 -0800
From: michael@webactor.dk (michael vernersen)
Subject: Perl::API2 PDF problem.
Message-Id: <b1c145db.0402290222.4acbf39a@posting.google.com>
I have a thing i want to do with perl::api2 pdf module.
Having search for days but i can't figure out this simple thing...
I want to create a new pdf document ( could by many pages ) where each
side should have the logo, from another pdf file ( 1 page )
The problem comes when the new pdf has more than a single page , then i
can't put the logo on the following pages.
So the best i have , and i doesn't work is :
$pdf=PDF::API2->new;
$pdf=PDF::API2->open('/pdf/1.pdf');
$pages=10; $t=0;
while ($t<$pages) {
$page=$pdf->page();
$page=$pdf->openpage(1);
$t++;
}
$pdf->saveas($filename);
$pdf->end;
Any suggestions ???????????????????
Thanks in advance...
Regards , Michael.
------------------------------
Date: Sat, 28 Feb 2004 17:14:09 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: reading output file data as input data
Message-Id: <slrnc42861.6on.tadmc@magna.augustmail.com>
Stephen Moon <vibfft@yahoo.com> wrote:
> At the command prompt,
>
> I type "perl test.pl <file1> <file2> <file3>" to run the program.
>
> Initially, I open <file1> as an input file and output the information
> to <file2>. Later on in the same program, I use <file2> as an input
> and write the output to <file3>.
>
> I get an error saying that "filehandler FH opened for output only"
> although I close the <file2> and reopen it with a new filehandle.
There is an error on line 42.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 29 Feb 2004 01:49:55 GMT
From: Beable van Polasm <beable+unsenet@beable.com.invalid>
Subject: Re: reading output file data as input data
Message-Id: <rjishq1wx0.fsf@dingo.beable.com>
vibfft@yahoo.com (Stephen Moon) writes:
> At the command prompt,
>
> I type "perl test.pl <file1> <file2> <file3>" to run the program.
>
> Initially, I open <file1> as an input file and output the information
> to <file2>. Later on in the same program, I use <file2> as an input
> and write the output to <file3>.
>
> I get an error saying that "filehandler FH opened for output only"
> although I close the <file2> and reopen it with a new filehandle.
There's probably something wrong with your program "test.pl".
--
------------------------------
Date: 29 Feb 2004 03:02:35 -0800
From: vibfft@yahoo.com (Stephen Moon)
Subject: Re: reading output file data as input data
Message-Id: <9feadd98.0402290302.7a3d97fd@posting.google.com>
Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnc42861.6on.tadmc@magna.augustmail.com>...
> Stephen Moon <vibfft@yahoo.com> wrote:
> > At the command prompt,
> >
> > I type "perl test.pl <file1> <file2> <file3>" to run the program.
> >
> > Initially, I open <file1> as an input file and output the information
> > to <file2>. Later on in the same program, I use <file2> as an input
> > and write the output to <file3>.
> >
> > I get an error saying that "filehandler FH opened for output only"
> > although I close the <file2> and reopen it with a new filehandle.
>
>
> There is an error on line 42.
well, actually there is an error on line 45:)
I will look into more and try to figure out.
In C, there is a way to make a file readable, writable, appendable, etc.
Is there a way to do the same in perl in the Windows environment?
-Steve
------------------------------
Date: Sun, 29 Feb 2004 20:17:40 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: reading output file data as input data
Message-Id: <c1shol$qg0$1@pin3.tky.plala.or.jp>
Stephen Moon wrote:
> Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnc42861.6on.tadmc@magna.augustmail.com>...
>
>>Stephen Moon <vibfft@yahoo.com> wrote:
>>
>>>At the command prompt,
>>>
>>>I type "perl test.pl <file1> <file2> <file3>" to run the program.
>>>
>>>Initially, I open <file1> as an input file and output the information
>>>to <file2>. Later on in the same program, I use <file2> as an input
>>>and write the output to <file3>.
>>>
>>>I get an error saying that "filehandler FH opened for output only"
>>>although I close the <file2> and reopen it with a new filehandle.
>>
>>
>>There is an error on line 42.
>
> well, actually there is an error on line 45:)
> I will look into more and try to figure out.
You're missing the point. There are lots of people willing to help, but
with the limited description given and lack of any code whatsoever its
difficult to see what's going on - except for those who have figured out
how to use the PSI::ESP module :)
> In C, there is a way to make a file readable, writable, appendable, etc.
> Is there a way to do the same in perl in the Windows environment?
'perldoc perlopentut' from your shell. The documentation covers the many
ways to open files in Perl.
HTH - keith
------------------------------
Date: Sun, 29 Feb 2004 08:16:02 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: reading output file data as input data
Message-Id: <slrnc43t12.hgn.tadmc@magna.augustmail.com>
Stephen Moon <vibfft@yahoo.com> wrote:
> In C, there is a way to make a file readable, writable, appendable, etc.
> Is there a way to do the same in perl in the Windows environment?
Yes.
You open files in Perl using the appropriately named open() function.
Perhaps the documentation for that function might help...
perldoc -f open
Your articles may become invisible if you don't stop asking us
to read the documentation for you...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Feb 2004 23:16:32 -0500
From: Steven Vasilogianis <stevenv@operamail.com>
Subject: Re: Regex help needed for complicated mass renaming
Message-Id: <868yimjza7.fsf@a21.ada>
bbq_pit@hotmail.com (BBQ) writes:
> I have inherited a series of files in the following format:
>
> TestTest1.txt
> TestTest2.jpg
> Test_Test3.txt
> Test_TestTest4.txt
> NASATest.txt
> NASATest5.txt
> TestTestTestTest.mpg
> Test6Test.txt
> Test.txt
my @file_names = qw(
TestTest1.txt TestTest2.jpg Test_Test3.txt
Test_TestTest4.txt NASATest.txt NASATest5.txt
TestTestTestTest.mpg Test6Test.txt Test.txt
);
foreach ( @file_names ) {
@parts = split /(?=(?<!^)[A-Z](?![A-Z]))|_/;
print lc(join '_', @parts), "\n";
}
gives me the output you wanted:
> test_test1.txt
> test_test2.jpg
> test_test3.txt
> test_test_test4.txt
> nasa_test.txt
> nasa_test5.txt
> test_test_test_test.mpg
> test6_test.txt
> test.txt
I came up with the regular expression independently of Jay Tilton's, but
they seem similar enough that I don't need to explain it again. Using
split just seemed to make sense to me here.
HTH,
--
steven vasilogianis
------------------------------
Date: Sun, 29 Feb 2004 06:17:56 -0600
From: "yamini" <yamini_rajan@nospam.com>
Subject: regex
Message-Id: <0718f9d29a0f06e3e416352e9e03a16c@localhost.talkaboutprogramming.com>
$_="{NP_PP}the<pp>tyrosine</pp>_-phosphorylated_<Bppf>proteins</Bppf>{/NP_PP}";
can anyone help in writing a regex to extraxt "tyrosine"
from $_?
thanks!!!
------------------------------
Date: Sun, 29 Feb 2004 12:17:03 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: regex
Message-Id: <c1sl62$1rh$1@news.simnet.is>
"yamini" <yamini_rajan@nospam.com> wrote in message
news:0718f9d29a0f06e3e416352e9e03a16c@localhost.talkaboutprogramming.com...
>
$_="{NP_PP}the<pp>tyrosine</pp>_-phosphorylated_<Bppf>proteins</Bppf>{/NP_PP
}";
> can anyone help in writing a regex to extraxt "tyrosine"
> from $_?
show us what you tried, and how it failed
you asked a similar question a few days ago. if the answers
you got did not help then, it will make no change to
ask the question again.
rather, you should show us how you tried to use them,
and explain in what way things did not work.
the answer to your question is trivial, and I could answer it here,
but the regex itself obviously is not the problem, or you would
not be repeating your questions.
gnari
------------------------------
Date: Sun, 29 Feb 2004 08:58:28 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: regex
Message-Id: <slrnc43vgk.hgn.tadmc@magna.augustmail.com>
yamini <yamini_rajan@nospam.com> wrote:
> $_="{NP_PP}the<pp>tyrosine</pp>_-phosphorylated_<Bppf>proteins</Bppf>{/NP_PP}";
> can anyone help in writing a regex to extraxt "tyrosine"
> from $_?
Sure. Here are several ways:
--------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
$_="{NP_PP}the<pp>tyrosine</pp>_-phosphorylated_<Bppf>proteins</Bppf>{/NP_PP}";
my $str;
$str = $1 if m>\>(.*?)<>;
print "[$str]\n";
$str = (split m<<.*?>>)[1];
print "[$str]\n";
$str = $1 if /(t\w{3,})/;
print "[$str]\n";
$str = substr $_, 14, 8;
print "[$str]\n";
$str = join '', (split //)[14..21];
print "[$str]\n";
s/.*<pp>//s;
s\</pp>.*\\s;
$str = $_;
print "[$str]\n";
--------------------------------------------
That last one destroys the string in $_ though, so you will probably
want to choose one of the other ones to use in your program.
> thanks!!!
You're welcome!!!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 29 Feb 2004 16:38:39 +0100
From: Sandman <mr@sandman.net>
Subject: Re: regex
Message-Id: <mr-14A50D.16383929022004@news.fu-berlin.de>
In article
<0718f9d29a0f06e3e416352e9e03a16c@localhost.talkaboutprogramming.com>,
"yamini" <yamini_rajan@nospam.com> wrote:
> $_="{NP_PP}the<pp>tyrosine</pp>_-phosphorylated_<Bppf>proteins</Bppf>{
> /NP_PP}";
> can anyone help in writing a regex to extraxt "tyrosine" from $_?
Extracts?
$_=~s/(tyrosine)//;
print;
print "\n" . $1;
--
Sandman[.net]
------------------------------
Date: Sat, 28 Feb 2004 19:41:23 -0800
From: "anonymous" <anonymous@anon.com>
Subject: regular expression to capture invalid emails
Message-Id: <k5mdnRSQd-tzw9zdRVn-sA@mminternet.net>
Ok, what I want to do is simple. I want to create a regular expression that
matches any email address that ends in two characters like antyhing@home.tv
but not anything@home.us my working regexp: (.*)@(.*)\.(\w){2}$
how do I change it so it doesn't match .us? I want to do it all in one
expression for specific reasons.
------------------------------
Date: 29 Feb 2004 03:51:48 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: regular expression to capture invalid emails
Message-Id: <slrnc42oek.l42.sholden@flexal.cs.usyd.edu.au>
On Sat, 28 Feb 2004 19:41:23 -0800, anonymous <anonymous@anon.com> wrote:
> Ok, what I want to do is simple. I want to create a regular expression that
> matches any email address that ends in two characters like antyhing@home.tv
> but not anything@home.us my working regexp: (.*)@(.*)\.(\w){2}$
> how do I change it so it doesn't match .us? I want to do it all in one
> expression for specific reasons.
replace (\w){2} with (?!us)(\w){2}
assumming you want such strange capturing.
See "perldoc perlre" for details, and feel free to read it before
posting.
--
Sam Holden
------------------------------
Date: Sat, 28 Feb 2004 20:01:13 -0800
From: "anonymous" <anonymous@anon.com>
Subject: Re: regular expression to capture invalid emails
Message-Id: <ef-dndyBYdMJ_tzdRVn-sQ@mminternet.net>
Thanks, Sam I had a feeling that ?! was the answer but I didn't understand
its implementation. People like you are why Perl Rocks.
"Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
news:slrnc42oek.l42.sholden@flexal.cs.usyd.edu.au...
> On Sat, 28 Feb 2004 19:41:23 -0800, anonymous <anonymous@anon.com> wrote:
> > Ok, what I want to do is simple. I want to create a regular expression
that
> > matches any email address that ends in two characters like
antyhing@home.tv
> > but not anything@home.us my working regexp: (.*)@(.*)\.(\w){2}$
> > how do I change it so it doesn't match .us? I want to do it all in one
> > expression for specific reasons.
>
> replace (\w){2} with (?!us)(\w){2}
>
> assumming you want such strange capturing.
>
> See "perldoc perlre" for details, and feel free to read it before
> posting.
>
> --
> Sam Holden
------------------------------
Date: Sat, 28 Feb 2004 22:53:38 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: regular expression to capture invalid emails
Message-Id: <0nd0c.24392$253.1663657@news20.bellglobal.com>
"anonymous" <anonymous@anon.com> wrote in message
news:k5mdnRSQd-tzw9zdRVn-sA@mminternet.net...
> Ok, what I want to do is simple. I want to create a regular expression
that
> matches any email address that ends in two characters like
antyhing@home.tv
> but not anything@home.us my working regexp: (.*)@(.*)\.(\w){2}$
> how do I change it so it doesn't match .us? I want to do it all in one
> expression for specific reasons.
>
Assuming you're using a module like Email::Valid to check the validity of
the address first (no comments on all the ways your check above would fail),
you could just check that the address doesn't end with "us" or 3+
characters:
next if $email =~ /\.(us|\w{3,})$/i;
Matt
------------------------------
Date: 29 Feb 2004 04:04:20 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: regular expression to capture invalid emails
Message-Id: <slrnc42p64.lba.sholden@flexal.cs.usyd.edu.au>
On Sat, 28 Feb 2004 20:01:13 -0800, anonymous <anonymous@anon.com> wrote:
> Thanks, Sam I had a feeling that ?! was the answer but I didn't understand
> its implementation. People like you are why Perl Rocks.
No people who write the code and submit patches and bug reports and
feedback and design and stuff deserve any credit for perl.
And top posting is frowned upon in these parts, see the posting
guidelines.
--
Sam Holden
------------------------------
Date: Sat, 28 Feb 2004 20:08:08 -0800
From: "anonymous" <anonymous@anon.com>
Subject: Re: regular expression to capture invalid emails
Message-Id: <iMWdnQL1Qf-p-NzdRVn-iQ@mminternet.net>
You make good points Matt but I am only interested in filtering out emails
that end in two characters that are not us.
In what ways would the regexp fail to do that simple task?
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:0nd0c.24392$253.1663657@news20.bellglobal.com...
>
> "anonymous" <anonymous@anon.com> wrote in message
> news:k5mdnRSQd-tzw9zdRVn-sA@mminternet.net...
> > Ok, what I want to do is simple. I want to create a regular expression
> that
> > matches any email address that ends in two characters like
> antyhing@home.tv
> > but not anything@home.us my working regexp: (.*)@(.*)\.(\w){2}$
> > how do I change it so it doesn't match .us? I want to do it all in one
> > expression for specific reasons.
> >
>
> Assuming you're using a module like Email::Valid to check the validity of
> the address first (no comments on all the ways your check above would
fail),
> you could just check that the address doesn't end with "us" or 3+
> characters:
>
> next if $email =~ /\.(us|\w{3,})$/i;
>
> Matt
>
>
------------------------------
Date: Sun, 29 Feb 2004 10:11:34 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: regular expression to capture invalid emails
Message-Id: <c1sdqq$107$1@news.simnet.is>
"anonymous" <anonymous@anon.com> wrote in message
news:iMWdnQL1Qf-p-NzdRVn-iQ@mminternet.net...
[ please do not top post]
[rearranging the order of quoted lines]
>
> "Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
> news:0nd0c.24392$253.1663657@news20.bellglobal.com...
> >
> > "anonymous" <anonymous@anon.com> wrote in message
> > news:k5mdnRSQd-tzw9zdRVn-sA@mminternet.net...
> > > ... my working regexp: (.*)@(.*)\.(\w){2}$
> >
> > Assuming you're using a module like Email::Valid to check the validity
of
> > the address first (no comments on all the ways your check above would
> > fail),
> You make good points Matt but I am only interested in filtering out emails
> that end in two characters that are not us.
> In what ways would the regexp fail to do that simple task?
Matt was talking about the email address validation. your regexp,
would for example accept the following addresses:
::::::@@@@@:::::@@@@.........tv
@.tv
I may be wrong, but these look invalid to me.
gnari
------------------------------
Date: 29 Feb 2004 06:12:52 -0800
From: david_jerus_1969@voila.fr (David)
Subject: using perl script to compile java
Message-Id: <e820535.0402290612.32539204@posting.google.com>
Hi everybody,
I'm trying to do a small perl sript to compile a basic java code.
This is what I've done so far. the name of Java code is "hello.java",
and the name of the perl script is "compile". This is how I run it
:compile Hello.java
There are 2 steps, the first one is to create the hello.class which is
normally done, by writing javac hello.java.
the script is :
'javac $argv[0]';
The second step is to do java hello, using the Hello.class created,
and this what I did in my script to do that :
opendir (DH, "."); # open the local directory
foreach $file (@list) {
if ($file =~ /class$/) {
$trouve = $file;
last;} # search the Hello. class.
}
@test = split(/.class/,$trouve,2); # separate Hello from Hello.class
and run it
'java $test[0]'; #this line of code is supposed to do the step 2 but
it doesn't work.
any idea is welcomed.
Cheers;
David
------------------------------
Date: Sun, 29 Feb 2004 09:20:27 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: using perl script to compile java
Message-Id: <slrnc440pr.hqc.tadmc@magna.augustmail.com>
David <david_jerus_1969@voila.fr> wrote:
> I'm trying to do a small perl sript to compile a basic java code.
You want to do more than just compile java code.
> There are 2 steps, the first one is to create the hello.class which is
> normally done, by writing javac hello.java.
The 1st step is compiling.
!system 'javac hello.java' or die 'problem compiling';
> The second step is to do java hello
The 2nd step is _executing_ what was compiled in step 1.
!system 'java hello' or die 'problem executing';
> opendir (DH, "."); # open the local directory
Why is this here?
You never make use of the DH directory handle in your code...
What if you are not able to open the directory? You should check to
see if you got what you asked for:
opendir(DH, ".") or die "could not open cwd $!";
> foreach $file (@list) {
You have never put anything into @list, so the code in the
foreach block in never executed, so we can skip over that
without even reading it.
> any idea is welcomed.
1) see the Posting Guidelines that are posted here frequently
2) perldoc -f system
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 29 Feb 2004 01:08:33 +0000
From: Andy Dingley <dingbat@codesmiths.com>
Subject: Re: XML best practices (was: Python as replacement for PHP?)
Message-Id: <1hd240haqpbmnqdltavdt6t24ue0jvcl92@4ax.com>
On Sat, 28 Feb 2004 03:54:49 -0000, claird@lairds.com (Cameron Laird)
wrote:
>Let me get this straight: your preferred vehicle for XML
>parsing is Perl regular expressions? That's ... well,
Rather more restrained a comment than I'd be capable of expressing ?
------------------------------
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 6194
***************************************