Chapter 9. Performing Form Validation with Regular Expressions

It's your responsibility as a developer to ensure that your users' data is useful to your app, so you need to ensure that critical information is validated before storing it in your database.

In the case of the calendar application, the date format is critical: if the format isn't correct, the app will fail in several places. To verify that only valid dates are allowed into the database, you'll use regular expressions (regexes), which are powerful pattern-matching tools that allow developers much more control over data than a strict string comparison search.

Before you can get started with adding validation to your application, you need to get comfortable using regular expressions. In ...

Get Pro PHP and jQuery now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.