The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl, with just a few differences. Some features that appeared in Python and PCRE before they appeared in Perl are also available using the Python syntax, there is some support for one or two .NET and Oniguruma syntax items, and there is an option for requesting some minor changes that give better JavaScript compatibility. from original documentation PHP PCRE
. Any character
^ Start of subject (or line in multiline mode)
$ End of subject (or line in multiline mode)
[ Start character class definition
] End character class definition
| Alternates (OR)
( Start subpattern
) End subpattern
\ Escape character
\n Newline (hex 0A)
\r Carriage return (hex 0D)
\t Tab (hex 09)
\d Decimal digit
\D Charchater that is not a decimal digit
\h Horizontal whitespace character
\H Character that is not a horizontal whitespace character
\s Whitespace character
\S Character that is not a whitespace character
\v Vertical whitespace character
\V Character that is not a vertical whitespace character
\w “Word” character
\W “Non-word” character
\b Word boundary
\B Not a word boundary
\A Start of subject (independent of multiline mode)
\Z End of subject or newline at end (independent of multiline mode)
\z End of subject (independent of multiline mode)
\G First matching position in subject
n* Zero or more of n
n+ One or more of n
n? Zero or one occurrences of n
{n} n occurrences
{n,} At least n occurrences
{,m} At the most m occurrences
{n,m} Between n and m occurrences
Interactive PHP
Learn interactive PHP click here to find out more

Pingback: Replace html tags with regexp