Giter Site home page Giter Site logo

xiaolifeipiao / common-regex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cdoco/common-regex

0.0 0.0 0.0 1.4 MB

:jack_o_lantern: 常用正则表达式 - 收集一些在平时项目开发中经常用到的正则表达式。

License: MIT License

common-regex's Introduction

目录

邮箱

[email protected] 只允许英文字母、数字、下划线、英文句号、以及中划线组成

^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$

email

高子航[email protected] 名称允许汉字、字母、数字,域名只允许英文域名

^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$

email

电话

13012345678 手机号

^1(3|4|5|6|7|8|9)\d{9}$

phone

XXX-XXXXXXX XXXX-XXXXXXXX 固定电话

(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}

email

域名

https://google.com/

^((http:\/\/)|(https:\/\/))?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}(\/)

domain-name

IP

127.0.0.1

((?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d))

ip

帐号校验

gaozihang_001 字母开头,允许5-16字节,允许字母数字下划线

^[a-zA-Z][a-zA-Z0-9_]{4,15}$

user

字符校验

汉字

高子航

^[\u4e00-\u9fa5]{0,}$

chinese

英文和数字

^[A-Za-z0-9]+$

char

长度为3-20的所有字符

^.{3,20}$

char

英文字符

由26个英文字母组成的字符串

^[A-Za-z]+$

char

由26个大写英文字母组成的字符串

^[A-Z]+$

char

由26个小写英文字母组成的字符串

^[a-z]+$

char

由数字和26个英文字母组成的字符串

^[A-Za-z0-9]+$

char

由数字、26个英文字母或者下划线组成的字符串

^\w+$

char

中文、英文、数字包括下划线

^[\u4E00-\u9FA5A-Za-z0-9_]+$

char

中文、英文、数字但不包括下划线等符号

^[\u4E00-\u9FA5A-Za-z0-9]+$

char

禁止输入含有%&',;=?$"等字符

[^%&',;=?$\x22]+

char

禁止输入含有~的字符

[^~\x22]+

char

数字正则

整数

^-?[1-9]\d*$

num

正整数

^[1-9]\d*$

num

负整数

^-[1-9]\d*$

num

非负整数

^[1-9]\d*|0$

num

非正整数

^-[1-9]\d*|0$

num

浮点数

^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$

num

正浮点数

^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$

num

负浮点数

^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$

num

非负浮点数

^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$

num

非正浮点数

^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$

num

License

MIT License. See the LICENSE file.

⬆ top

common-regex's People

Contributors

cdoco avatar middle3shan 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.