Home

Awesome

URL RegExp

Travis build status NPM version

RegExp object to match and validate URL(s).

Usage

import URLRegExp from 'url-regexp';

Validate URL

URLRegExp.validate('input string');

Match URLs

URLRegExp.match() will return all valid URLs from the string.

URLRegExp.match('input string');

Replace URLs

URLRegExp.replace() will replace all url instances depending on the passed replacment string or function identical as String.prototype.replace().

let strWithUrls;

strWithUrls = 'John favorite website is http://twitter.com';
URLRegExp.replace(strWithUrls, 'twitter');
// John favorite website is twitter

Download

Download using NPM:

npm install --save url-regexp