PHP Regular Expression

Regular expression in PHP allows finding and replacing a particular string in PHP. Especially PHP regular expression is used to validate form and compare strings etc.

PHP Regular Expression

PHP regular expression allows programmer to perform various task like comparing, finding and replacing a particular type of strings. Using Regular expression one can easily validate user form or perform complex manipulations between strings.

PHP Regular expression also allows you to validate a email, phone numbers and zip codes etc. In short we can say that it is a pattern-matching functionality that allows you to match, find, replace or divide strings in small chunks.

There are basically two types of PHP Regular Expression.

  • POSIX Regular Expressions
  • PERL Style Regular Expressions

PHP Examples