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.
You can find for more details, API on 📚 Documentation.
useful-regexp was designed to work both in the browser and in 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'));
<script src="lib/useful-regexp/index.min.js"></script>
<script>
usefulRegexp.isTel('0341-86091234');
</script>
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);