Skip to main content
Email Password   helpLost your password?

Introduction

Regular expressions are the best and the easiest way to do data validation. If you want to check for a valid date, then programming for it will be very complicated. A simple solution is to create a regular expression for what you need, and compare the input with the expression itself. Regular expressions are very powerful as they can reduce the size of the code and are also easy to understand.

The regular expression validator attached with this article allows users to create their own rules and then check for its validity.

If you see the source files, you will find the use of Datatable, XML and RegEx for achieving this task. This combination will work for large databases. But if you want to simplify the code, the Datatable can be removed and all the working can be directly performed through XML and RegEX.

The validation rules can be made for three basic data types: Date, Number and String. The rules can be used efficiently to make sure that the data is entered in correct format.

The code can be used in any application for comparing records so that the data entered is what we require. The use of XML makes it easier for storing the validation rules.

Using the code

Classes have been created for each data type to make it easier to handle. The user does not have to bother about the class. This classes are used for generating the regular expression, and in turn the XML for the rule selected by the user. The user just has to pass the XML string and the records get validated.

Data types

All the comparison is performed using regular expressions i.e., regular expressions are generated for the rules.

How to use the application

Follow these steps:

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
Generalcan't see regular expression Pin
halibut8763
8:02 20 Jul '07  
GeneralRegular Expression Pin
Dewang Ajmera.
22:08 8 Jan '07  
GeneralWhere in the Regular expression Pin
satesh
21:32 19 Jul '06  
GeneralRe: Where in the Regular expression Pin
Vasant Raj
3:37 25 Jul '06  
GeneralWhere is the regular expression? Pin
korell
11:31 13 Jul '05  
GeneralRe: Where is the regular expression? Pin
Vasant Raj
18:05 13 Jul '05  
GeneralRegular Expression Pin
Mehul__Patel
22:15 6 Mar '05  
GeneralRe: Regular Expression Pin
Vasant Raj
22:57 6 Mar '05  


Last Updated 29 Apr 2005 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009