PHP code example of okapi / wildcards
1. Go to this page and download the library: Download okapi/wildcards 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/ */
okapi / wildcards example snippets
use Okapi\Wildcards\Regex;
// Simple wildcard
$regex = Regex::fromWildcard('*.php');
$regex->matches('index.php'); // true
$regex->matches('index.html'); // false
// Wildcard with groups
$regex = Regex::fromWildcard('(*.php)|(*.html)');
$regex->matches('index.php'); // true
$regex->matches('index.html'); // true
$regex->matches('index.js'); // false
// Wildcard with optional characters
$regex = Regex::fromWildcard('index[*].php');
$regex->matches('index.php'); // true
$regex->matches('index.test.php'); // true
$regex->matches('index_2.php'); // true