[17283] in Perl-Users-Digest
Perl-Users Digest, Issue: 4705 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 23 21:10:42 2000
Date: Mon, 23 Oct 2000 18:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972349816-v9-i4705@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 23 Oct 2000 Volume: 9 Number: 4705
Today's topics:
Regular expression help jsfinn@my-deja.com
Re: Regular expression help <jihad.battikha@sharewire.com>
Re: Regular expression help s_punk@my-deja.com
Re: Regular expression help <jeff@vpservices.com>
Re: Regular expression help <jihad.battikha@sharewire.com>
Re: Regular expression help <lr@hpl.hp.com>
Re: Regular expression help <bart.lateur@skynet.be>
Re: Regular expression help (Craig Berry)
Re: Regular expression help <jeffp@crusoe.net>
Re: Regular expression help <godzilla@stomp.stomp.tokyo>
Re: Removing line breaks from a string - HELP! <harrisr@bignet.net>
Submit buttons <jlinch@mediaone.net>
Re: Traversing any workstation of a Windows domain <abe@ztreet.demon.nl>
Re: What will the code look like? <themoriman@ntlworld.com>
Re: What will the code look like? <hldpub@ix.netcom.com>
Re: What will the code look like? (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Oct 2000 22:03:39 GMT
From: jsfinn@my-deja.com
Subject: Regular expression help
Message-Id: <8t2cjn$oha$1@nnrp1.deja.com>
Can someone please help me write a regular expression?
I am trying to do password validation matching - here are the
contraints:
At least 6 alpha-numeric characters
there must be at least 1 digit
there must be at least 1 letter
Thanks
Jeff
jsfinn@my-deja.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 23 Oct 2000 18:19:23 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: Regular expression help
Message-Id: <39F4B96B.40A32CE9@sharewire.com>
jsfinn@my-deja.com wrote:
> I am trying to do password validation matching - here are the
> contraints:
>
> At least 6 alpha-numeric characters
> there must be at least 1 digit
> there must be at least 1 letter
if (($password =~ /\d.*\d.*\d.*\d.*\d.*\d/) && ($password =~
/[a-zA-Z]/)) {
# passed
} else {
# failed
}
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: Mon, 23 Oct 2000 22:10:41 GMT
From: s_punk@my-deja.com
Subject: Re: Regular expression help
Message-Id: <8t2d0r$p0o$1@nnrp1.deja.com>
Are you trying to pass a password or get a password?
In article <8t2cjn$oha$1@nnrp1.deja.com>,
jsfinn@my-deja.com wrote:
> Can someone please help me write a regular expression?
>
> I am trying to do password validation matching - here are the
> contraints:
>
> At least 6 alpha-numeric characters
> there must be at least 1 digit
> there must be at least 1 letter
>
> Thanks
>
> Jeff
>
> jsfinn@my-deja.com
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 23 Oct 2000 15:28:31 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Regular expression help
Message-Id: <39F4BB8F.2510ADEC@vpservices.com>
jsfinn@my-deja.com wrote:
>
> Can someone please help me write a regular expression?
>
> I am trying to do password validation matching - here are the
> contraints:
>
> At least 6 alpha-numeric characters
> there must be at least 1 digit
> there must be at least 1 letter
/\d/ && /\D/ && /^[a-zA-Z0-9]{6,}$/
--
(just another) Jeff
------------------------------
Date: Mon, 23 Oct 2000 18:41:05 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: Regular expression help
Message-Id: <39F4BE81.47853C50@sharewire.com>
> > At least 6 alpha-numeric characters
> > there must be at least 1 digit
> > there must be at least 1 letter
I wrote:
> if (($password =~ /\d.*\d.*\d.*\d.*\d.*\d/) && ($password =~
> /[a-zA-Z]/)) {
> # passed
> } else {
> # failed
> }
Whoops, I missed the "alpha-" in alpha-numeric. Please ignore my
previous post and try:
/[a-zA-Z0-9]{6}/ && /\d/ && /[a-zA-Z]/
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: Mon, 23 Oct 2000 15:51:04 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Regular expression help
Message-Id: <MPG.145e60b0b2c09c6098ae5a@nntp.hpl.hp.com>
In article <39F4B96B.40A32CE9@sharewire.com> on Mon, 23 Oct 2000
18:19:23 -0400, Jihad Battikha <jihad.battikha@sharewire.com> says...
> jsfinn@my-deja.com wrote:
>
> > I am trying to do password validation matching - here are the
> > contraints:
> >
> > At least 6 alpha-numeric characters
> > there must be at least 1 digit
> > there must be at least 1 letter
>
>
> if (($password =~ /\d.*\d.*\d.*\d.*\d.*\d/) && ($password =~
> /[a-zA-Z]/)) {
> # passed
> } else {
> # failed
> }
Reread the problem spec. Not six digits, but six alphanumeric
characters.
Locale-dumb version (ASCII letters only):
tr/A-Za-z_0-9// >= 6 && tr/0-9// && tr/A-Za-z//
Locale-wise version:
/(?:\w.*){6}/s && /\d/ && /[^\W_\d]/
The regexes could be combined using positive lookahead, but it amounts
to the same thing, and the above is easier to grasp.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 23 Oct 2000 23:03:34 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regular expression help
Message-Id: <nqg9vskl3g3u19a33opj48goikrhp18cdr@4ax.com>
jsfinn@my-deja.com wrote:
>Can someone please help me write a regular expression?
>
>I am trying to do password validation matching - here are the
>contraints:
>
>At least 6 alpha-numeric characters
>there must be at least 1 digit
>there must be at least 1 letter
You don't say if it may contain anything other than alphanumeric.
Assuming you don't care:
tr/0-9// and tr/a-zA-Z// and tr/a-zA-Z0-9// >= 6
What, no regex? Indeed, no. Counting characters in character classes,
instead.
--
Bart.
------------------------------
Date: Mon, 23 Oct 2000 23:25:52 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Regular expression help
Message-Id: <sv9i80savpq9d6@corp.supernews.com>
jsfinn@my-deja.com wrote:
: I am trying to do password validation matching - here are the
: contraints:
:
: At least 6 alpha-numeric characters
: there must be at least 1 digit
: there must be at least 1 letter
Assuming candidate password in $_:
$is_valid = length >= 6 && # length is at least 6
! /[^A-Za-z0-9]/ && # no non-alphanumerics
/[A-Za-z]/ && # at least one alpha
/[0-9]/; # at least one numeric
Sometimes, decomposition is the cleanest and most maintainable approach.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Mon, 23 Oct 2000 19:33:01 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Regular expression help
Message-Id: <Pine.GSO.4.21.0010231929200.1894-100000@crusoe.crusoe.net>
On Oct 23, Bart Lateur said:
> tr/0-9// and tr/a-zA-Z// and tr/a-zA-Z0-9// >= 6
Wouldn't
/\d/ and /[a-zA-Z]/ and tr/a-zA-Z0-9// >= 6
be faster-ish? The m//'s stop after the first find, unlike tr///. Oh,
and you may be able to use this trick somewhere:
(/\d[a-zA-Z]/ or /[a-zA-Z]\d/) and /\A[\da-zA-Z]{6,}\z/
which will work if the string MUST be letters and numbers. By the
pigeon-hole principle (I believe that is what can be applied here), if a
string is ONLY letters and digits, and there must be at least one letter
and at least one digit, a letter must be directly after a number, or
vice-versa.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Mon, 23 Oct 2000 17:36:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Regular expression help
Message-Id: <39F4D970.FAEA67B6@stomp.stomp.tokyo>
Larry Rosler wrote:
> Jihad Battikha wrote:
> > jsfinn wrote:
(snipped)
Mr. Rosler, would you mind helping me with
this code of yours? I am being sincere, this
is not one of my usual con jobs. I've managed
to confuse myself after reading documentation
via Randal's books. Please?
> Locale-dumb version (ASCII letters only):
> tr/A-Za-z_0-9// >= 6 && tr/0-9// && tr/A-Za-z//
This above, I understand, no problem.
if tr alpha / digits greater than equal to 6
logical and
if tr digits returns true
logical and
if tr alpha letters returns true
This I follow ok for what it does.
This next one has me boogered on the trinary
conditional operator.
> Locale-wise version:
> /(?:\w.*){6}/s && /\d/ && /[^\W_\d]/
trinary conditional operator (I'm am lost here)
word characters / don't care / 6 characters / treat as a single expression
logical and
if digits true
logical and
if negated alpha letters set true
After reading up on this ?: I see it as:
text expression ? if true expression : if false expression
I know your code works and have no need to test. How
does this trinary widget work in your syntax? Is it
testing what it is inside those memory parentheses
or is it testing the entire contents of the match
operator? Otherwords, is your trinary evaluating
(?:\w.*)
or evaluating
/(?:\w.*){6}/
as a whole?
Am I confused because it is evaluating $_
to check if it matches word characters,
don't care, and 6 characters?
I have confused myself, Mr. Rosler, trying
to figure out how it fits into this syntax
from Randal's book:
($n == 1) ? " " : "s";
This is from page 91 of his Programming Perl.
What is your syntax pulling in for evaluation
which is the equal to ($n == 1) in Randal's
cited syntax example?
I hope I have worded my question in a way
you understand what I am asking! Well, at
least I am reading and trying to understand
this despite my air headed ways. =)
Thanks Mr. Rosler,
K
------------------------------
Date: Mon, 23 Oct 2000 20:40:26 -0400
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <sv9mine1mgvt2b@corp.supernews.com>
Bart Lateur <bart.lateur@skynet.be> wrote in message
news:dec9vsc8tnqq9hv98cohmsbbtb08m5956u@4ax.com...
> Russ Jones wrote:
>
> >"G!" wrote:
> >>
> >> Your inherent ignorance beguiles your own malice intent
> >> and significant degree of illiteracy, consistently.
> >
> >You really should look up some of these harder words before you use
> >them.
>
> I don't think that would help.
>
> --
> Bart.
Maybe if we took up a collection we could get her some Prozak?
------------------------------
Date: Tue, 24 Oct 2000 01:02:51 GMT
From: "Jerry Linch" <jlinch@mediaone.net>
Subject: Submit buttons
Message-Id: <%c5J5.278$h32.225140@typhoon.southeast.rr.com>
Is it possible to have multiple Submit buttons on a form? What I want to do
is set up a form to add, edit, or delete a database record. My thought is to
have a Submit button for each of these actions. Obviously, I would want to
be able to tell, from the Perl script, which button was pressed so that I
could handle it appropriately. Any help on this would be appreciated.
Jerry Linch
jlinch@mediaone.net
------------------------------
Date: Tue, 24 Oct 2000 00:45:55 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Traversing any workstation of a Windows domain
Message-Id: <bdd9vssmcrfmb0164uci5kah6t6l9dqlbu@4ax.com>
On Mon, 23 Oct 2000 23:24:21 +0200, otto.wyss@bluewin.ch (Otto Wyss)
wrote:
> I want to know if a specific file is on any workstation of a Windows
> domain. Each workstation runs Windows NT4.0 and has a share "C$". Are
> there any modules which traverses a Windows domain and maps a share on
> any discovered workstation? Does anybody have an example for such a task
> (the script should run on Windows)?
Sharenames that end in '$' are hidden by nature.
Take a look at:
perldoc Win32::NetResource
it looks promising (only tried the example) for retrieving machine names
from the network.
($NETRESOURCE{DisplayType} == RESOURCEDISPLAYTYPE_SERVER)
The File::Find module seems to work with UNC paths (\\machinename\c$).
See:
perldoc File::Find
for more information.
--
Good luck,
Abe
##
perl -Mstrict -wle 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W].$"};print@{[Just,another,Perl,hacker]}'
------------------------------
Date: Mon, 23 Oct 2000 23:39:56 +0100
From: "The Moriman" <themoriman@ntlworld.com>
Subject: Re: What will the code look like?
Message-Id: <g63J5.9599$bL1.196386@news6-win.server.ntlworld.com>
The Starmaker <hldpub@ix.netcom.com> wrote in message
news:39F4AFE3.48E6@ix.netcom.com...
>What will the
> code look like to act as a "visitor" to my web site and send a
> fictitious http_referer and a fake IP address.
>
fwiw
Why don't you try putting some decent content on your site, real people
might then have an incentive to visit it!
Apart from that, it can be very difficult at times to get in touch with
yourself.
btw It wasn't you that Spike was referring to, was it?
TMMan
As I was walking up the stair
I met a man who wasn't there
He wasn't there again today
I wish to God he'd go away
(Spike Milligan)
------------------------------
Date: Mon, 23 Oct 2000 15:53:33 -0700
From: The Starmaker <hldpub@ix.netcom.com>
Subject: Re: What will the code look like?
Message-Id: <39F4C16D.13B6@ix.netcom.com>
Jihad Battikha wrote:
> Man, good luck fooling your own server! Like, will you have to give
> yourself amnesia after you do this so that you won't know it's you
> faking yourself out? If you get the fake IP address thing figured out,
> let us know!
Well, I got the fake IP address figured out partly by simply using a
list of wingates.
------------------------------
Date: Mon, 23 Oct 2000 18:54:29 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: What will the code look like?
Message-Id: <slrn8v9gd5.5e7.tadmc@magna.metronet.com>
On Mon, 23 Oct 2000 23:39:56 +0100, The Moriman <themoriman@ntlworld.com> wrote:
>btw It wasn't you that Spike was referring to, was it?
>As I was walking up the stair
>I met a man who wasn't there
>He wasn't there again today
>I wish to God he'd go away
>(Spike Milligan)
Who is Spike Milligan, and what has he done with poor Ogden Nash?
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4705
**************************************