Chapter 14.  Validation and Regular Expressions

Table of Contents

14.1. Input Masks
14.1.1. Exercises: Input Masks
14.2. Validators
14.2.1. Exercises: Validators
14.3. Regular Expressions
14.3.1. Regular Expression Syntax
14.3.2. Regular Expressions: Phone Number Recognition
14.3.3. Exercises: Regular Expressions
14.4. Regular Expression Validation
14.5. Subclassing QValidator
14.6. Exercises: Validation and Regular Expressions
14.7. Review Questions

[ fromfile: validation.xml id: validation ]

Abstract

Input data generally needs to be screened, or validated, to make sure that it is appropriate. Numeric data generally needs to be within certain ranges. String data often must have a certain format. Validation of input data is an important issue that can be handled in an object-oriented way by a combination of Qt classes. This chapter discusses some efficient ways of validating input, including the use of regular expressions.

For fine grained control of input:

For restricting input to common types: