PHP code example of regexto / validators
1. Go to this page and download the library: Download regexto/validators library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
regexto / validators example snippets
egexTo\Validators\Validator;
// 1. Quick boolean test (substring match)
$isMatched = Validator::test('email', 'Please contact us at [email protected]'); // true
// 2. Strict full-string validation
$isValid = Validator::validate('email', '[email protected]'); // true
egexTo\Validators\Validator;
$results = Validator::detect('192.168.0.1');
echo $results[0]['pattern']['slug']; // "ipv4"