A code is worth a thousand words

PHP - Replace using regex

You are here

Search and replace using regular expression in PHP using preg_replace function. It is very powerful way to search and replace. I suggest using some online regular expression tool to test out your patterns.

Source code viewer

/**

* In regular expressions parentheses are used to determinate subpatterns.