PHP preg_replace – dot all (PCRE_DOTALL) example – sandbox

HP preg_replace example for dot all (PCRE_DOTALL) match. By default dot does not match newline char. When we specify dot all (using “s” regex modifier flag) it matches with newline also. These is useful for multiline content matching.

$replaced_content = preg_replace($pattern, $replacement, $content [, int $limit = -1 [, int &$count]])
Input
Pattern example: /abc/i
Replacement
Content

Comments

Click here to write/view comments