Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
FILTER_VALIDATE_REGEXP constant in PHP
The FILTER_VALIDATE_REGEXP constant validates a value against a Perl-compatible regular expression.
Options
regexp − The regular expression to validate against.
Return
The FILTER_VALIDATE_REGEXP constant does not return anything.
Example
<?php
$val="example.com";
$res = array("options"=>array("regexp"=>"/^ex(.*)/"));
if(filter_var($val, FILTER_VALIDATE_REGEXP,$res)) {
echo "Matched String!";
} else {
echo "Not a Matched String!";
}
?>
The following is the output.
Matched String!
Advertisements
