
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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