Re: test a password string for correctness

2001-12-20 Thread Philip Newton
On Thu, 13 Dec 2001 18:10:26 -0500, [EMAIL PROTECTED] (Ryan Fischer) wrote: This should do it I think: /[a-zA-Z]/==3/[0-9]/==2/^.{5,}$/; Pattern match in scalar context returns true or false, so the maximum number is 1. You'll never get 3 out of a pattern match in scalar context (and ==

Re: test a password string for correctness

2001-12-20 Thread Philip Newton
On Thu, 13 Dec 2001 19:25:02 -0500 (EST), [EMAIL PROTECTED] (Jeff 'Japhy' Pinyan) wrote: I'd probably include capitalized operators in the obscure group Which capitalised operators? NE, LT, and friends? I think they went away in bleadperl... didn't they? Cheers, Philip

Re: test a password string for correctness

2001-12-20 Thread Philip Newton
On Thu, 13 Dec 2001 10:50:11 -0500, [EMAIL PROTECTED] (Ronald J Kimball) wrote: (y/a-zA-Z// 2) (y/0-9// 1) Each numeric comparison will return either 1 or 0. In my experience, 1 or , rather than 1 or 0. Or is FALSE (PL_NO?) a special value which looks like 0 to operators that care, such

Re: test a password string for correctness

2001-12-20 Thread Bart Lateur
On Thu, 20 Dec 2001 19:00:30 +0100, Philip Newton wrote: On Thu, 13 Dec 2001 10:50:11 -0500, [EMAIL PROTECTED] (Ronald J Kimball) wrote: (y/a-zA-Z// 2) (y/0-9// 1) Each numeric comparison will return either 1 or 0. In my experience, 1 or , rather than 1 or 0. Or is FALSE (PL_NO?) a

Re: test a password string for correctness

2001-12-17 Thread abigail
On Thu, Dec 13, 2001 at 03:24:14PM +0100, Sven Neuhaus wrote: On Thu, Dec 13, 2001 at 03:01:43PM +, Mohit Agarwal wrote: On Thu, Dec 13, 2001 at 02:49:05PM +0100, Sven Neuhaus wrote: y/A-Za-z/A-Za-z/2y/0-9/0-9/1 or the shorter $a=$_;y/A-Za-z//2y/0-9//1 that will

Re: test a password string for correctness

2001-12-14 Thread Piers Cawley
Jeremy Zawodny [EMAIL PROTECTED] writes: On Thu, Dec 13, 2001 at 07:00:19PM -0500, Jeff 'japhy' Pinyan wrote: On Dec 13, Ryan Fischer said: And it's not an obscure use NOR an abuse of the function. The fact that tr/a-z// replaces the empty replacement list with a-z is SPECIFICALLY

Re: test a password string for correctness

2001-12-13 Thread Kim Schulz
On Thu, 13 Dec 2001 14:36:38 +0100 Bart Lateur [EMAIL PROTECTED] wrote: On Thu, 13 Dec 2001 14:29:14 +0100, Kim Schulz wrote: How short kan you make a program (oneliner?) that: * checks if a password is 5 characters long or more * checks if the password contains at least 3 alpha chars

Re: test a password string for correctness

2001-12-13 Thread Sven Neuhaus
On Thu, Dec 13, 2001 at 02:36:38PM +0100, Bart Lateur wrote: On Thu, 13 Dec 2001 14:29:14 +0100, Kim Schulz wrote: How short kan you make a program (oneliner?) that: * checks if a password is 5 characters long or more * checks if the password contains at least 3 alpha chars (a-zA-Z) * checks

Re: test a password string for correctness

2001-12-13 Thread Robin Houston
On Thu, Dec 13, 2001 at 02:29:14PM +0100, Kim Schulz wrote: How short kan you make a program (oneliner?) that: * checks if a password is 5 characters long or more * checks if the password contains at least 3 alpha chars (a-zA-Z) * checks if the password contains at least 2 numbers (0-9)

Re: test a password string for correctness

2001-12-13 Thread Kim Schulz
On Thu, 13 Dec 2001 14:43:18 +0100 [snip] Short enough? Not exactly.. how about a password lige ab12345 ? it's more than 5 characters long, but only 2 of then are letters. This password shouldn't be accepted. DOOH! my mistake. I didnt think this one over enough. ofcause will this

Re: test a password string for correctness

2001-12-13 Thread Mohit Agarwal
On Thu, Dec 13, 2001 at 02:49:05PM +0100, Sven Neuhaus wrote: /^(?=.*\d.*\d)(?=.*[a-z].*[a-z].*[a-z])/i y/A-Za-z/A-Za-z/2y/0-9/0-9/1 or the shorter $a=$_;y/A-Za-z//2y/0-9//1 that will mungle the password in $_ but keep a good copy in $a. Why will it mungle the

Re: test a password string for correctness

2001-12-13 Thread Philippe 'BooK' Bruhat
En réponse à Ariel Scolnicov [EMAIL PROTECTED]: Robin Houston [EMAIL PROTECTED] writes: It's interesting to try do it as a single regex. The shortest I've found is: /(?=[a-z].*[a-z].*[a-z]).*\d.*\d/ /(?=(.*[a-z])){3}(.*\d){2}/i (you also need the i I guess). But yours

Re: test a password string for correctness

2001-12-13 Thread Sven Neuhaus
On Thu, Dec 13, 2001 at 03:01:43PM +, Mohit Agarwal wrote: On Thu, Dec 13, 2001 at 02:49:05PM +0100, Sven Neuhaus wrote: y/A-Za-z/A-Za-z/2y/0-9/0-9/1 or the shorter $a=$_;y/A-Za-z//2y/0-9//1 that will mungle the password in $_ but keep a good copy in $a. Why will

RE: test a password string for correctness

2001-12-13 Thread Richard_Cox
On 13 December 2001 13:29, Kim Schulz [mailto:[EMAIL PROTECTED]] wrote How short kan you make a program (oneliner?) that: * checks if a password is 5 characters long or more As noted, this is covered below... * checks if the password contains at least 3 alpha chars (a-zA-Z) * checks if

Re: test a password string for correctness

2001-12-13 Thread Mohit Agarwal
On Thu, Dec 13, 2001 at 03:24:14PM +0100, Sven Neuhaus wrote: It won't - I was confusing it with the behavior of some tr programs. So it's y/A-Za-z//2y/0-9//1 Too bad you can't write y/A-Za-z// y/0-9// 1 As some say, a space is still a byte. Looks like this one can't be made any

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 03:24:14PM +0100, Sven Neuhaus wrote: On Thu, Dec 13, 2001 at 03:01:43PM +, Mohit Agarwal wrote: On Thu, Dec 13, 2001 at 02:49:05PM +0100, Sven Neuhaus wrote: y/A-Za-z/A-Za-z/2y/0-9/0-9/1 or the shorter $a=$_;y/A-Za-z//2y/0-9//1 that will

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 08:36:03AM -0600, [EMAIL PROTECTED] wrote: If you are prepared to change $_: if (y/a-zA-Z//2y/0-9//1) {# 24 chars for the test print not valid; } That does not change $_. If you can't change $_, you need the c opt on the y's, hence: if

RE: test a password string for correctness

2001-12-13 Thread Patrick Gaskill
To: '[EMAIL PROTECTED]' Subject: RE: test a password string for correctness Here's my attempt, at 39: #!/usr/bin/perl $_=pop;print if(/[a-z]{3,}/i/\d{2,}/) I skipped the first constraint, because if rules 2 and 3 are true, 1 will always be true... right? -- Patrick -Original

Re: test a password string for correctness

2001-12-13 Thread Kim Schulz
On Thu, 13 Dec 2001 10:12:05 -0500 Patrick Gaskill [EMAIL PROTECTED] wrote: Oh, maybe I should've finished sifting through the rest of the posts first... and I guess she never said that the characters would be in a row...*sigh* hehe it's HE not she! In Denmark Kim is a Boys name. :o)

RE: test a password string for correctness

2001-12-13 Thread Ala Qumsieh
From: Sven Neuhaus [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 9:24 AM To: [EMAIL PROTECTED] Subject: Re: test a password string for correctness Too bad you can't write y/A-Za-z// y/0-9// 1 Rejoice and be happy for in Perl 6 you should be able to do just

RE: test a password string for correctness

2001-12-13 Thread Bernie Cosell
On 13 Dec 2001, at 10:25, Ala Qumsieh wrote: From: Sven Neuhaus [mailto:[EMAIL PROTECTED]] Too bad you can't write y/A-Za-z// y/0-9// 1 Rejoice and be happy for in Perl 6 you should be able to do just that! But, this solution is still wrong because it will not allow the

Re: test a password string for correctness

2001-12-13 Thread Rafael Garcia-Suarez
Ariel Scolnicov wrote in fwp: Ronald J Kimball [EMAIL PROTECTED] writes: If you are prepared to change $_: if (y/a-zA-Z//2y/0-9//1) {# 24 chars for the test print not valid; } That does not change $_. But, just to keep things interesting, you can't do

Re: test a password string for correctness

2001-12-13 Thread Lian Sebe
You've ruined the magic! (Next time you'll get less feedback to your problem(s). ;-) - Original Message - From: Kim Schulz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 13, 2001 5:24 PM Subject: Re: test a password string for correctness hehe it's HE not she

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Mohit Agarwal said: On Thu, Dec 13, 2001 at 03:24:14PM +0100, Sven Neuhaus wrote: It won't - I was confusing it with the behavior of some tr programs. So it's y/A-Za-z//2y/0-9//1 As some say, a space is still a byte. Looks like this one can't be made any shorter. Japhy, Eugene,

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Jeff 'japhy' Pinyan said: is probably where I'd get to. I think RJK's attempt to cheat the system fails: y/a-zA-Z//y/0-9//1 My bad. He had y/a-zA-Z//2y/0-9//1 which is perfectly valid. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 10:41:57AM -0500, Jeff 'japhy' Pinyan wrote: I probably would have thought about y/// after a while, but I can't pass up a good regex. ;) y/a-zA-Z//2y/0-9//1 is probably where I'd get to. I think RJK's attempt to cheat the system fails: y/a-zA-Z//y/0-9//1

RE: test a password string for correctness

2001-12-13 Thread Richard_Cox
On 13 December 2001 14:40 Ronald J Kimball [mailto:[EMAIL PROTECTED]] wrote: if (y/a-zA-Z//2y/0-9//1) { # 24 chars for the test print not valid; } That does not change $_. Which explains my lack of understanding of a few previous golds... Richard Cox Senior Software

Re: test a password string for correctness

2001-12-13 Thread Uri Guttman
RF == Ryan Fischer [EMAIL PROTECTED] writes: y/a-zA-Z//2y/0-9//1 RF That's not gonna do it. You'll kill $_. :( you don't know y/// too well if you think that. it is a well known perl golf trick. uri -- Uri Guttman -- [EMAIL PROTECTED] http://www.stemsystems.com --

Re: test a password string for correctness

2001-12-13 Thread Ryan Fischer
RF == Ryan Fischer [EMAIL PROTECTED] writes: y/a-zA-Z//2y/0-9//1 RF That's not gonna do it. You'll kill $_. :( you don't know y/// too well if you think that. it is a well known perl golf trick. uri Bleh. You learn something new every day. But, if anything, I'd say that's a

Re: test a password string for correctness

2001-12-13 Thread Uri Guttman
RF == Ryan Fischer [EMAIL PROTECTED] writes: RF Bleh. You learn something new every day. But, if anything, I'd say RF that's a glaring bug and not a feature. translations are supposed to RF replace one character with another. If no character is specified, the RF most intuitive thing

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Ryan Fischer said: Bleh. You learn something new every day. But, if anything, I'd say that's a glaring bug and not a feature. translations are supposed to replace one character with another. If no character is specified, the most intuitive thing to happen is an omission. What

Re: test a password string for correctness

2001-12-13 Thread Ryan Fischer
rtfm. Hehe... I read it years ago. But how kind of you to flame me. You must feel so good about yourself. ;) i wouldn't call them counter intuitive as they are clearly documented and make it more flexible than your single use approach would. To each his own. Not everyone has the time to

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Ryan Fischer said: i wouldn't call them counter intuitive as they are clearly documented and make it more flexible than your single use approach would. To each his own. Not everyone has the time to dink around and pat each other on the back at obscure usages and abuses of

Re: test a password string for correctness

2001-12-13 Thread Jeremy Zawodny
On Thu, Dec 13, 2001 at 07:00:19PM -0500, Jeff 'japhy' Pinyan wrote: On Dec 13, Ryan Fischer said: And it's not an obscure use NOR an abuse of the function. The fact that tr/a-z// replaces the empty replacement list with a-z is SPECIFICALLY documented, and the use of this for counting

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Jeremy Zawodny said: Think back to when you were first learning Perl. Or regular expressions. They're documented but you still find yourself thinking damn, this is obscure... Are you wrong? New experiences often seem obscure. I don't think a person LEARNING the language can

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Jeff 'japhy' Pinyan said: On Dec 13, Jeremy Zawodny said: Think back to when you were first learning Perl. Or regular expressions. They're documented but you still find yourself thinking damn, this is obscure... Are you wrong? New experiences often seem obscure. I don't think a

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 07:11:09PM -0500, Ryan Fischer wrote: I guess it simply wasn't good that the guy asked a question on an FWP list where TMTOWTDI and so many people think the short ways are better. If he was simply looking for an answer, any other list would have worked fine. I guess

Re: test a password string for correctness

2001-12-13 Thread Bill Jones
... The problem is when people value that over getting the job done, and try to make people feel inferior with their knowledge. Greetings :) I disagree. Growth in the direction of effectiveness in Perl dictates learning to read code - especially when Perl has the bad tag of a Write

Re: test a password string for correctness

2001-12-13 Thread Ryan Fischer
You wrote: On Thu, Dec 13, 2001 at 07:11:09PM -0500, Ryan Fischer wrote: I guess it simply wasn't good that the guy asked a question on an FWP list where TMTOWTDI and so many people think the short ways are better. If he was simply looking for an answer, any other list would have worked

Re: test a password string for correctness

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Uri Guttman said: if i ever saw someone getting a string length in real code with tr/// i would kick them hard. on the other hand counting the number of newlines in a string is a valid use of that effect. in fact there is no other simple and fast way to count newlines in a string but