14.7.  Review Questions

[ fromfile: validation-questions.xml id: validation-questions ]

  1. What is an input mask? What can an input mask do for you?

     An inputMask is a QString property of a QLineEdit which can contain mask chars to constrain the incoming text. An inputMask can specify what kinds of characters are allowed in certain positions of a string that is being typed into a QLineEdit.

  2. What is a regular expression? What can you use it for?

  3. What is a validator? What is it used for?

  4. Describe three different kinds of validators.

  5. What is a regular expression meta-character? There are four kinds of metacharacters: quantifier, character set, group, and anchor. Give examples of each type and explain what they mean.

      A meta-character is a character that "describes" other characters. Quantifiers are ?*+{m,n} - they modify the preceeding thing with a quantity. Character Sets are things that can be replaced by other characters: .\d\D\s\S\w\W[a-z]. Grouping characters are parantheses (), which let you back-reference parts of the matched result. Anchoring characters describe what goes at the beginning or end of the pattern: ^\b\B$.

  6. Why would you want to extend QValidator?

      When the thing you are checking is not a simple regular expression, but something that requires advance calculation.