checking for uppercase and lowercase varchars

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

checking for uppercase and lowercase varchars

Post by gurjit »

Hi all,

I want to check whether a user has input all lowercase varchars for "username" and all uppercase varchars for "password".

How can i do this?

If possible can this check be done in the query?
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: checking for uppercase and lowercase varchars

Post by jmut »

gurjit wrote:Hi all,

I want to check whether a user has input all lowercase varchars for "username" and all uppercase varchars for "password".

How can i do this?

If possible can this check be done in the query?
preg_match ("%^[A-Z]*$%",$sring) -> only uppercase letters
preg_match ("%^[a-z]*$%",$sring) -> only lowercase letters
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

ctype_alnum()? or ctype_print();
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

Cheers Guys, got it sorted.

Thanks for all the help.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

you could always strtoupper() or strtolower() before you store any information ;)
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply