28/06
2017
dev-master
9999999-devRegular expression for matching URLs
MIT
The Development Requires
by Ippei Sumida
Wallogit.com
2017 © Pedro Peláez
Regular expression for matching URLs
Regular expression for matching URLs, (*1)
Based on this gist by Diego Perini., (*2)
composer require ippey/url-regex
<?php
require_once('vendor/autoload.php');
use Ippey\UrlRegex;
// true
$result = Ippey\UrlRegex::isMatch('This contains URL. http://www.google.com');
// false
$result = Ippey\UrlRegex::isMatch('This contains no URL.');
// array('http://www.google.com')
$result = Ippey\UrlRegex::match('This contains URL. http://www.google.com');
// array()
$result = Ippey\UrlRegex::match('This contains no URL.');
// array('https://www.google.co.jp/?q=github', 'https://www.github.com')
$result = Ippey\UrlRegex::match('This contains URL. https://www.google.co.jp/?q=github and https://www.github.com');
Ippei Sumida, (*3)
MIT, (*4)
Regular expression for matching URLs
MIT