$str = preg_replace('#<img[^>]*\ssrc="[^"]*knopka\.jpg"[^>]*>#i', '', $str);
$str = $arrAllItem['Model'];
$str = preg_replace(
'#[A-Z][-/.,+*()\d]*\K[А-ЯЁ]+|[А-ЯЁ][-/.,+*()\d]*\K[A-Z]+#iu',
'<b style="color: blue;">$0</b>',
$str
);
echo $str;
$str = $arrAllItem['Model'];
$str = preg_replace(
'#(?>\K[A-Z]+()|\K[А-ЯЁ]+()|[-/.,+*()\d]+)+?\1\2#iu',
'<b style="color: blue;">$0</b>',
$str
);
echo $str;
(?:email":\["|\G(?!\A)",")\K[^"]+
[^"]+@[^"]+(?<=email":\["[^\[\]]+)
(?!...)
$text = preg_replace(
'#\[url=(?!https?://site\.ru)\S*\](\[img.*?\]\S*\[/img\])\[/url\]#i',
'$1',
$text
);
$white_list = ['site3.ru', 'site4.ru'];
$text = '
[url=https://site1.ru/page][img]https://site1.ru/file.jpg[/img][/url]
[url=https://site2.ru/page][img]https://site2.ru/file.jpg[/img][/url]
[url=https://site3.ru/page][img]https://site3.ru/file.jpg[/img][/url]
[url=https://site4.ru/page][img]https://site4.ru/file.jpg[/img][/url]
';
$text = preg_replace_callback(
'#\[url=(\S*)\](\[img.*?\]\S*\[/img\])\[/url\]#i',
function ($m) use($white_list) {
$host = parse_url($m[1], PHP_URL_HOST);
if (in_array($host, $white_list))
return $m[0];
return $m[2];
},
$text
);
[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]
[\x00-\x7F](?<![a-z\d])
(?![a-z\d])[\x00-\x7F]
/\b(?!code\b)\w+/gi
/\w+\b(?<!\bcode)/gi
/\b(?!(?:word1|word2|word3)\b)\w+/gi
/\w+\b(?<!\b(?:word1|word2|word3))/gi
str.replace(
/(?:(?<=<div\s+class="dialog__row_\d+">)|{([A-F\d]{6})})\s*([^\s<{][^<{]*)/g,
function () {
arguments.callee.color = arguments[1] || arguments.callee.color;
return `<span style="color:#${arguments.callee.color}">${arguments[2]}</span>\n`
}
)
^\d\d(?:[ .,]\d\d?)*$
^\d\d(?:([.,])\d(?:\d(?:\1\d\d?|)|)|)(?: \d\d(?:([.,])\d(?:\d(?:\2\d\d?|)|)|))*$