regex-go
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Regex Go

Regex Go is a convenient package that provides some common regular expressions.

Usage

Install this package:

npm install regex-go --save

Use the APIs you need in your program, e.g.:

import { isDomain } from 'regex-go';

if (isDomain('google.com')) {
  console.log('This is a domain!');
}

If you want to use ESModule version, you should need to import this package from regex-go/esm, the default one is es moudle.

API Reference

Domain

isDomain(s: string): boolean

If the string is a domain.

Email

isEmail(s: string): boolean

If the string is an email address.

String

containsEmoji(s: string): boolean Test if the string contains emoji. (the pattern comes from emoji-regex)

containsChinese(s: string): boolean Test if the string contains Chinese characters.

Build

Just install the dependencies and run npm run build.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i regex-go

Weekly Downloads

4

Version

0.4.0

License

MIT

Unpacked Size

106 kB

Total Files

12

Last publish

Collaborators

  • backrunner