preg_replace
<?php
$string = 'April 15, 2003';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);
preg_replace
<?php
$string = 'April 15, 2003';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);
preg_replace examples
$result = preg_replace('/abc(def)hij/', '/\\1/', $string);
$result = preg_replace('/abc(def)hij/', '/$1/', $string);
$result = preg_replace('/abc(def)hij/', '/${1}/', $string);
preg_replace examples
$result = preg_replace(
array('/pattern1/', '/pattern2/'),
array('replace1', 'replace2'),
$string
);
php preg_replace callback
$text = preg_replace_callback(
"/\\[\\[([^|]+\\|)(.*?)\\]\\]/",
[ $this, 'linkReplace' ],
$text
);
$text = preg_replace( "/<\/?[^>]+>/", "", $text );
return $text;
preg_replace examples
# Strip HTML tag
$result = preg_replace('#<span id="15">.*</span>#m', '', $string);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us