filtro de PHP FILTER_VALIDATE_REGEXP
Definição e Uso
filtros FILTER_VALIDATE_REGEXP para verificar o valor com base nas expressões regulares compatíveis com Perl.
- Nome: "validate_regexp"
- ID-number: 272
Opções possíveis:
- regexp - disposições relativas à verificação são baseados em expressões regulares
Exemplos
<?php
$string = "Match this string";
var_dump(filter_var($string, FILTER_VALIDATE_REGEXP,
array("options"=>array("regexp"=>"/^M(.*)/"))))
?>
$string = "Match this string";
var_dump(filter_var($string, FILTER_VALIDATE_REGEXP,
array("options"=>array("regexp"=>"/^M(.*)/"))))
?>
código de saída é o seguinte:
string(17) "Match this string"
PHP completa Filtro de Referência