PHP code example of xp-framework / patterns
1. Go to this page and download the library: Download xp-framework/patterns 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/ */
xp-framework / patterns example snippets
use text\regex\Pattern;
$pattern= Pattern::compile('([w]{3}\.)?example\.(com|net|org)');
if ($pattern->matches($input)) {
// Looks like an example domain
}
$result= $pattern->match($input);
$group= $result->group(0); // [ "www.example.com", "www.", "www", "com" ]