| | |
Regex for password
![]() |
•
•
Join Date: Jul 2005
Posts: 23
Reputation:
Solved Threads: 0
some pretty standard ones are [A-Z] && [a-z] && [0-9], that should at least get you through the must require cap letters, lowercase letters and a number. The rest will depend on what you are running, such as awk, sed, grep, etc....
Let me know if this helps and what you are running this on and I'll be glad to help ya out.
Let me know if this helps and what you are running this on and I'll be glad to help ya out.
•
•
Join Date: May 2005
Posts: 215
Reputation:
Solved Threads: 16
I am kind of learning as I go. you are able to test for length of a string using this method
so this will test for a variable with the lengths inbetween 6 and 11
Shell Scripting Syntax (Toggle Plain Text)
var='abcdef' echo ${#var}
so this will test for a variable with the lengths inbetween 6 and 11
Shell Scripting Syntax (Toggle Plain Text)
#!/bin/bash echo "enter your password" read PASS if ((${#PASS} >= 6)) && ((${#PASS} <= 11)) then echo "password has been accepted" fi
•
•
Join Date: May 2005
Posts: 215
Reputation:
Solved Threads: 16
this will check if the lenght is between 6 and 11
this will check if you have at least one lowecase letter
this will check if you have at least one uppercase letter
this will check if you have at least one number
this will check if you have a letter at the end, either upper or lowercase
I am not sure(yet) how to determine if all of the chartacters are iether numbers, or letters, no special character. Example $%&^.
I will let you know what I figure out :-)
Shell Scripting Syntax (Toggle Plain Text)
((${#PASS} >= 6)) && ((${#PASS} <= 11))
this will check if you have at least one lowecase letter
Shell Scripting Syntax (Toggle Plain Text)
[[ $VAR == *[a-z]* ]]
this will check if you have at least one uppercase letter
Shell Scripting Syntax (Toggle Plain Text)
[[ $VAR == *[A-Z]* ]]
this will check if you have at least one number
Shell Scripting Syntax (Toggle Plain Text)
[[ $VAR == *[1-9]* ]]
this will check if you have a letter at the end, either upper or lowercase
Shell Scripting Syntax (Toggle Plain Text)
[[ $VAR == *[a-zA-Z] ]]
I am not sure(yet) how to determine if all of the chartacters are iether numbers, or letters, no special character. Example $%&^.
I will let you know what I figure out :-)
•
•
Join Date: May 2005
Posts: 215
Reputation:
Solved Threads: 16
you can use this to check to see if your script has any characters other then numbers or letters
this will return a 0 if any non letters or numbers are found.
It would be very easy to combine all of these tests into a single script. I learned quite abit myself while looking for this info :-)
Shell Scripting Syntax (Toggle Plain Text)
[[ ${VAR} == *[^a-bA-B1-9]* ]]
It would be very easy to combine all of these tests into a single script. I learned quite abit myself while looking for this info :-)
![]() |
Similar Threads
- connect to password protected access db (Visual Basic 4 / 5 / 6)
- Windows 2000 Password Expired (Windows NT / 2000 / XP)
Other Threads in the Shell Scripting Forum
- Previous Thread: [Bash] problem with script in sed command
- Next Thread: help with shell script padding files with spaces
| Thread Tools | Search this Thread |





