PHP FILTER_VALIDATE_REGEXP filter
Definition and Usage
FILTER_VALIDATE_REGEXP filters to verify the value based on the Perl-compatible regular expressions.
- Name: "validate_regexp"
- ID-number: 272
Possible options:
- regexp - verification provisions are based on regular expressions
Examples
<?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(.*)/"))))
?>
Output code is as follows:
string(17) "Match this string"
Complete PHP Filter Reference