GithubHelp home page GithubHelp logo

wpsharks / unicode-gcs Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 40 KB

Unicode general categories; e.g., L, Ll, Lu, Nd, etc. This library makes it easy to build regular expressions in JavaScript that will consider all unicode scripts.

Home Page: https://websharks.github.io/unicode-gcs/

License: GNU General Public License v3.0

JavaScript 2.95% TypeScript 97.05%

unicode-gcs's Introduction

Unicode General Categories

Unicode general categories; e.g., L, Ll, Lu, Nd, etc. This library makes it easy to build regular expressions in JavaScript that will consider all unicode scripts.

NodeJs Acquisition

$ npm install ws-unicode-gcs --save-dev
const u = require('ws-unicode-gcs');

Browser Acquisition

<script src="./dist/index.min.js"></script>
<script>var u = WebSharks.UnicodeGcs;</script>

CDN Acquisition

Tip: To use a specific release, replace /1.0.3 in this URL with /[tag]

<script src="https://cdn.rawgit.com/websharks/unicode-gcs/1.0.3/dist/index.min.js"></script>
<script>var u = WebSharks.UnicodeGcs;</script>

Usage / Examples

var u = WebSharks.UnicodeGcs;
// Or: const u = require('ws-unicode-gcs');

var containsLetter = new RegExp('[' + u.L + ']');
var containsAnythingNotALetter = new RegExp('[^' + u.L + ']');
var isAllAlphanumeric = new RegExp('^[' + u.L + u.N + ']$');

if (containsLetter.test('Iñtërnâtiônàlizætiøn☃')) {
  console.log('Contains letter.'); // Yes
}
if (containsAnythingNotALetter.test('Iñtërnâtiônàlizætiøn☃')) {
  console.log('Contains something not a letter.'); // Yes
}
if (isAllAlphanumeric.test('Iñtërnâtiônàlizætiøn☃')) {
  console.log('Is all alphanumeric.'); // No
}

List of All WebSharks.UnicodeGcs Properties

/*
 * General Categories:
 *
 * L - Letter
 *     Ll - Lowercase letter.
 *     Lu - Uppercase letter.
 *     Lt - Titlecase letter.
 *     Lm - Modifier letter.
 *     Lo - Letter without case.
 *
 * M - Mark
 *     Mn - Non-spacing mark.
 *     Mc - Spacing combining mark.
 *     Me - Enclosing mark.
 *
 * N - Number
 *     Nd - Decimal digit.
 *     Nl - Letter number.
 *     No -  Other number.
 *
 * P - Punctuation
 *     Pd - Dash punctuation.
 *     Ps - Open punctuation.
 *     Pe - Close punctuation.
 *     Pi - Initial punctuation.
 *     Pf - Final punctuation.
 *     Pc - Connector punctuation.
 *     Po - Other punctuation.
 *
 * S - Symbol
 *     Sm - Math symbol.
 *     Sc - Currency symbol.
 *     Sk - Modifier symbol.
 *     So - Other symbol.
 *
 * Z - Separator
 *     Zs - Space separator.
 *     Zl - Line separator.
 *     Zp - Paragraph separator.
 *
 * C - Other
 *     Cc - Control.
 *     Cf - Format.
 *     Co - Private use.
 *     Cs - Surrogate.
 *     Cn - Unassigned.
 */
/*
 * Other Categories:
 *
 *     other.v - All vertical whitespace.
 *     other.h - All horizontal whitespace.
 *     other.s - All whitespace (vertical & horizontal).
 *
 *     other.scWordChars - Characters considered 'part of a word' in many spell checkers.
 *      Same as: L + M + N + Pd + Pc + ' (note: includes apostrophe in contractions).
 *
 *     other.aceWordChars - Word characters in the Ace web-based code/text editor.
 *      Same as: L + Mn + Mc + Nd + Pc + $_ (note: excludes Me, Nl, No, Pd).
 *
 *     other.atomNonWordChars - Non-word characters in the Atom code editor.
 *      Consists of: /\()"':,.;<>~!@#$%^&*|+=[]{}`?-…
 */

unicode-gcs's People

Watchers

James Cloos avatar Jason Caldwell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.