Skip to content

gajus/url-regexp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

RegExp object to match and validate URL(s).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •