filename-reserved-regex

WebJar for filename-reserved-regex

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

filename-reserved-regex
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

filename-reserved-regex
WebJar for filename-reserved-regex
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/filename-reserved-regex

Download filename-reserved-regex

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

filename-reserved-regex Build Status

Regular expression for matching reserved filename characters

On Unix-like systems / is reserved and <>:"/\|?* as well as non-printable characters \u0000-\u001F on Windows.

Install

$ npm install filename-reserved-regex

Usage

const filenameReservedRegex = require('filename-reserved-regex');

filenameReservedRegex().test('foo/bar');
//=> true

filenameReservedRegex().test('foo-bar');
//=> false

'foo/bar'.replace(filenameReservedRegex(), '!');
//=> 'foo!bar'

filenameReservedRegex.windowsNames().test('aux');
//=> true

API

filenameReservedRegex()

Returns a regex that matches all invalid characters.

filenameReservedRegex.windowsNames()

Returns an exact-match case-insensitive regex that matches invalid Windows filenames. These include CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8 and LPT9.

Versions

Version
2.0.0
1.0.0