[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Perl Regular Expressions for Password Checking

Posted on 2009-04-29
2
Medium Priority
?
456 Views
Last Modified: 2012-05-06
OK... I admit it... I'm a "regular expression" ignoramus.  

I'm enforcing passwords of at least 6 characters in length, with at least 1 uppercase letter, 1 lowercase letter, and at least 1 number.  How do I construct a regular expression that checks that?
0
Comment
Question by:eDistrict
2 Comments
 
LVL 19

Accepted Solution

by:
Kim Ryan earned 500 total points
ID: 24265075
Just chain togethor a regexp for each condition you need
my $pwd = '12A45b';

if ( $pwd =~ /\w{6,}/ and $pwd =~ /\d/ and $pwd =~ /[A-Z]/ and $pwd =~ /[a-z]/ )
{
    # password is valid
}
else
{
    #re enter password
}
0
 

Author Closing Comment

by:eDistrict
ID: 31576173
Thank you very much!  :)   I've GOT to break down and learn regexp's... :::sigh:::
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question