1.0.1 โ€ข Published 4 years ago

useful-regexp v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

useful-regexp

Useful regex patterns and functions for easier programming.

The repository is a derivative library of the following projects, designed to provide an API out of the box.

ChinaMobilePhoneNumberRegex

any-rule

:wrench: Getting Started

:card_file_box: Documentation

You can find for more details, API on ๐Ÿ“š Documentation.

:package: Install

useful-regexp was designed to work both in the browser and in Node.js.

Node.js

To get started with useful-regexp in your Node.js project, simply add the dependency with NPM.

$ npm install useful-regexp --save

Then include it in your script:

const regexp = require('useful-regexp');
// import * as regexp from 'useful-regexp' // ES 2015
console.log(regexp.isEmail('muikinghk@yahoo.com.hk'));

Browser

<script src="lib/useful-regexp/index.min.js"></script>
<script>
  usefulRegexp.isTel('0341-86091234');
</script>

Typescript

useful-regexp ships with official type declarations for TypeScript in NPM package out of the box.

$ yarn add useful-regexp
# or
$ npm install --save useful-regexp

Import and use in your Typescript file

import { isChineseName } from 'useful-regexp';

const name = 'ๅ–œๅก”่…Šยทๅฐ”ๆ™ด';

const isChinese = isChineseName(name);