ABSTRACT

Any form of data entering a website is potentially harmful. Input validation is therefore very important. This chapter presents two techniques for input validation. First, it introduces and explains Perl Compatible Regular Expressions (PCRE) as a means to verify input form data. PCRE closely resembles Perl in terms of pattern-matching functionality. The chapter then discusses a set of built-in validation functions for input validation. PCRE is a set of PHP functions that implement regular expression pattern-matching using the same syntax and semantics as Perl 5. PCRE uses special symbols to facilitate pattern-matching. The main advantage of PCRE is its flexibility. PCRE enables you to build a regex to validate any pattern. Perl is widely used in industry. The main advantage of built-in validation functions is their ease of use. To use them, no PCRE knowledge is required. The chapter concludes by introducing two small applications for safe report generation.