PHP RegEx

PHP includes function to work effectivly with strings by using regular expressions, this category is dedicated to documenting the use of these functions.

  1. Validating user-input is one of the most important ways to increase security and prevent hacks; in this article, I will show how to easily validate GET and POST parameters, and prevent your app from being abused to send spam.
  2. How to optimize image-loading and automatically include width and height attributes on img elements with PHP.
  3. Backslashes in replacement string seem to disappear when the replacement is done using preg_replace
  4. Backslash needs to be tediously excaped in PHP, both when uccuring inside your PHP script, and when used with preg_replace.
  5. Tutorial on how to replace parts of a string with str_replace and regular expressions.

PHP Regular Expressions

This category is dedicated to working with regular expressions in PHP through the preg_* functions.