Ответ 1
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}
Возможный дубликат:
preg_match php специальные символы
Привет всем, я хочу проверить, существуют ли эти символы в строке с помощью preg_match
:
^'£$%^&*()}{@'#~?><>,@|\-=-_+-¬'
Помогите пожалуйста!
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}
preg_match('/'.preg_quote('^\'£$%^&*()}{@#~?><,@|-=-_+-¬', '/').'/', $string);