url-regex

WebJar for url-regex

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

url-regex
Last Version

Last Version

3.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

url-regex
WebJar for url-regex
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/kevva/url-regex

Download url-regex

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/url-regex/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>url-regex</artifactId>
    <version>3.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/url-regex/
implementation 'org.webjars.npm:url-regex:3.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/url-regex/
implementation ("org.webjars.npm:url-regex:3.2.0")
'org.webjars.npm:url-regex:jar:3.2.0'
<dependency org="org.webjars.npm" name="url-regex" rev="3.2.0">
  <artifact name="url-regex" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='url-regex', version='3.2.0')
)
libraryDependencies += "org.webjars.npm" % "url-regex" % "3.2.0"
[org.webjars.npm/url-regex "3.2.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : ip-regex jar [1.0.1,2)

Project Modules

There are no modules declared in this project.

url-regex Build Status

Regular expression for matching URLs

Based on this gist by Diego Perini.

Install

$ npm install url-regex

Usage

const urlRegex = require('url-regex');

urlRegex().test('http://github.com foo bar');
//=> true

urlRegex().test('www.github.com foo bar');
//=> true

urlRegex({exact: true}).test('http://github.com foo bar');
//=> false

urlRegex({exact: true}).test('http://github.com');
//=> true

urlRegex({strict: false}).test('github.com foo bar');
//=> true

urlRegex({exact: true, strict: false}).test('github.com');
//=> true

'foo http://github.com bar //google.com'.match(urlRegex());
//=> ['http://github.com', '//google.com']

API

urlRegex([options])

Returns a RegExp for matching URLs.

options

exact

Type: boolean
Default: false

Only match an exact string. Useful with RegExp#test to check if a string is a URL.

strict

Type: boolean
Default: true

Force URLs to start with a valid protocol or www. If set to false it'll match the TLD against a list of valid TLDs.

Related

License

MIT © Kevin Mårtensson and Diego Perini

Versions

Version
3.2.0