🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

noncharacter-regex

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noncharacter-regex

Regular expression for matching or stripping non-characters from a string.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

noncharacter-regex NPM version Build Status

Regular expression for matching or stripping non-characters from a string.

Install with npm

npm i noncharacter-regex --save

Usage

var regex = require('noncharacter-regex');
regex.test('abc\uFFFExyz');
//=> 'true'

// strip non-characters
'abc\uFFFExyz'.replace(regex, '');

What's this all about?

non-characters are useful, for example, when you're doing string transformations and you need to use temporary placeholders to avoid unintentional mutations. In those cases, this regex would be used before do your transformations to ensure that any existing non-characters are removed before you do your replacements.

Does that happen!?

It's unlikely, but from time to time the U+FFFE non-character may show up in strings since it has the reverse binary sequence of byte-order marks.

Visit noncharacters for more info.

Run tests

Install dev dependencies:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license

This file was generated by verb on February 24, 2015.

Keywords

characters

FAQs

Package last updated on 27 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts