$url = '/internal_redirect/http://domain.com/?test=123&test2=234';
header("X-Accel-Redirect: " . $url);location ~ ^/internal_redirect/(?<url>.+) {
internal;
proxy_pass $url$is_args$args;
} $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;(?!...)$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
);$str = '1234145577';
$mask = '+7(###)###-##-##';
$i = 0;
$result = preg_replace_callback(
'/#/',
function ($m) use ($str, &$i) {
return $str[$i++] ?? $m[0];
},
$mask
);
echo $result; \d+ можно поменять на \d++\d++(?:\.\d+)?(?=\s*руб\.) \d+(*SKIP)(?:\.\d+)?(?=\s*руб\.)$str = 'Число 560
Размерный ряд: 42 88,44,46
#Цена: 400 руб 400коп. шт.
Место: 2А-75 корпус А';
preg_match('/ряд:.+/', $str, $m);
preg_match_all('/\d+/', $m[0], $r);
print_r($r[0]);preg_match_all('/(?:\G(?!^)|ряд:)[\s,]\K\d+/', $str, $r);preg_replace('#якорь|\[special\].*?\[/special\](*SKIP)(*F)#s', 'TXT', $str);<Files "users.json">
deny from all
</Files> $ar = array('Parameter #0 [ $operationName ]', 'Parameter #0 [ $operationName ]', 'Parameter #0 [ $operationName ]');
preg_match_all('/(?<=\[).+?(?=\])/' , implode($ar), $matches);
print_r($matches[0]); $text = preg_replace('~(\[store [^\]]*\])|\[[^\]]*\]~', '$1', $text);$text = preg_replace('~\[store [^\]]*\](*SKIP)(*F)|\[[^\]]*\]~', '', $text); $line = "text <p>text \n\n \n text \n text </p> text \n\n \n text\n";
$line = preg_replace('#(?:^|</p>).*?(?:\z|<p>)(*SKIP)(*F)|\n#is', '<br />', $line);
echo $line; RewriteRule ^mailing\.html$ /index.php?mailing=1 [L]
RewriteRule ^balance\.html$ /index.php?balance=1 [L]