Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Checking Your Work: Validating Input – The Cool Stuff

Dec 04, 2009, 09:31 (2 Talkback[s])
(Other stories by Curtis Dickens)

"You will find this type of comparison especially helpful when it comes to verifying numbers and validating character strings that should not have any numbers, such as names, for example. Below are scripts that apply to our form example in our first article where we check to make sure the name input is all characters and our number of years is a whole number. I have also included another common script that is outside the scope of our example which you will find useful for checking input to make sure it is formatted properly.

"The first thing we will need to do is to create some common variables to hold our expressions that we will use to validate against. Don’t worry if the expressions don’t make any sense to you. Creating regular expressions is an art form all its own. Whenever possible you should try to find an expression that someone else has already created and tested. Writing one from scratch can be both time consuming and tedious, especially for the novice."

Complete Story

Related Stories: