当前位置:网站首页>Regular symbol description
Regular symbol description
2022-07-28 20:22:00 【LifeBackwards】
1 Numbers :^[0-9]*$
2 n Digit number :^\d{n}$
3 At least n Digit number :^\d{n,}$
4 m-n Digit number :^\d{m,n}$
5 Zero and non-zero digits :^(0|[1-9][0-9]*)$
6 A number with a maximum of two decimal places beginning with a nonzero :^([1-9][0-9]*)+(.[0-9]{1,2})?$
7 belt 1-2 Positive or negative number of decimal places :^(\-)?\d+(\.\d{1,2})?$
8 Positive numbers 、 negative 、 And decimal fraction :^(\-|\+)?\d+(\.\d+)?$
9 A positive real number with two decimal places :^[0-9]+(.[0-9]{2})?$
10 Yes 1~3 Positive real number of decimal places :^[0-9]+(.[0-9]{1,3})?$
11 Nonzero positive integer :^[1-9]\d*$ or ^([1-9][0-9]*){1,3}$ or ^\+?[1-9][0-9]*$
12 Nonzero negative integer :^\-[1-9][]0-9"*$ or ^-[1-9]\d*$
13 Non-negative integer :^\d+$ or ^[1-9]\d*|0$
14 Non positive integer :^-[1-9]\d*|0$ or ^((-\d+)|(0+))$
15 Nonnegative floating point number :^\d+(\.\d+)?$ or ^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$
16 Non positive floating point number :^((-\d+(\.\d+)?)|(0+(\.0+)?))$ or ^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$
17 Positive floating point :^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ or ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$
18 Negative floating point number :^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ or ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$
19 Floating point numbers :^(-?\d+)(\.\d+)?$ or ^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$
Two 、 Expression for check character
1 Chinese characters :^[\u4e00-\u9fa5]{0,}$
2 English and numbers :^[A-Za-z0-9]+$ or ^[A-Za-z0-9]{4,40}$
3 The length is 3-20 All characters of :^.{3,20}$
4 from 26 A string of English letters :^[A-Za-z]+$
5 from 26 A string of uppercase letters :^[A-Z]+$
6 from 26 A string of lowercase letters :^[a-z]+$
7 By numbers and 26 A string of English letters :^[A-Za-z0-9]+$
8 By digital 、26 A string of English letters or underscores :^\w+$ or ^\w{3,20}$
9 chinese 、 english 、 Numbers include underscores :^[\u4E00-\u9FA5A-Za-z0-9_]+$
10 chinese 、 english 、 Number but excluding symbols such as underscores :^[\u4E00-\u9FA5A-Za-z0-9]+$ or ^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$
11 Can be entered with ^%&',;=?$\" Equal character :[^%&',;=?$\x22]+
12 Disable input containing ~ The characters of :[^~\x22]+
3、 ... and 、 Expression of special requirements
1 Email Address :^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
2 domain name :[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?
3 InternetURL:[a-zA-z]+://[^\s]* or ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
4 Phone number :^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
5 Phone number ("XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX" and "XXXXXXXX):^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$
6 Domestic phone number (0511-4405222、021-87888822):\d{3}-\d{8}|\d{4}-\d{7}
7 ID number (15 position 、18 Digit number ):^\d{15}|\d{18}$
8 Short ID number ( Numbers 、 Letter x ending ):^([0-9]){7,18}(x|X)?$ or ^\d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$
9 Is the account number legal ( Beginning of letter , allow 5-16 byte , Allow alphanumeric underscores ):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
10 password ( Start with a letter , The length is in 6~18 Between , Can only contain letters 、 Numbers and underscores ):^[a-zA-Z]\w{5,17}$
11 Strong password ( Must contain a combination of upper and lower case letters and numbers , Special characters cannot be used , The length is in 8-10 Between ):^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$
12 Date format :^\d{4}-\d{1,2}-\d{1,2}
13 One year 12 Months (01~09 and 1~12):^(0?[1-9]|1[0-2])$
14 A month 31 God (01~09 and 1~31):^((0?[1-9])|((1|2)[0-9])|30|31)$
15 Input format of money :
16 1. There are four forms of money we can accept :"10000.00" and "10,000.00", And no " branch " Of "10000" and "10,000":^[1-9][0-9]*$
17 2. This means that either of them can't 0 Number at the beginning , however , It also means a character "0" Not through , So we take the following form :^(0|[1-9][0-9]*)$
18 3. One 0 Or one doesn't 0 Number at the beginning . We can also allow a minus sign at the beginning :^(0|-?[1-9][0-9]*)$
19 4. This means a 0 Or a start that may be negative is not 0 The number of . Let users 0 The beginning is good. . Remove the minus sign as well , Because money can't be negative . What we're going to add here is the possible decimal part :^[0-9]+(.[0-9]+)?$
20 5. It must be noted that , There should be at least one after the decimal point 1 digit , therefore "10." No way , however "10" and "10.2" Yes. :^[0-9]+(.[0-9]{2})?$
21 6. In this way, we stipulate that there must be two decimal places after the decimal point , If you think it's too harsh , It can be like this :^[0-9]+(.[0-9]{1,2})?$
22 7. This allows the user to write only one decimal place . Now it's time to think about commas in numbers , We can do this :^[0-9]{1,3}(,[0-9]{3})*(.[0-9]{1,2})?$
23 8.1 To 3 A digital , Follow any one comma +3 A digital , Comma as optional , Not necessarily :^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$
24 remarks : This is the end result , Don't forget "+" It can be used "*" Instead, if you think empty strings are acceptable ( strange , Why? ?) Last , Don't forget to remove the backslash when using functions , Common mistakes are here
25 xml file :^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
26 Regular expression of Chinese characters :[\u4e00-\u9fa5]
27 Double byte character :[^\x00-\xff] ( Including Chinese characters , Can be used to calculate the length of a string ( A double byte character length meter 2,ASCII Character meter 1))
28 Regular expression for blank lines :\n\s*\r ( Can be used to delete blank lines )
29 HTML Tagged regular expression :<(\S*?)[^>]*>.*?</\1>|<.*? /> ( The version circulating on the Internet is too bad , This one is only part of it , There's nothing we can do about complex nested tags )
30 Regular expression of first and last whitespace characters :^\s*|\s*$ or (^\s*)|(\s*$) ( Can be used to delete blank characters at the beginning and end of a line ( Including Spaces 、 tabs 、 Page breaks and so on ), Very useful expressions )
31 tencent QQ Number :[1-9][0-9]{4,} ( tencent QQ Number from 10000 Start )
32 China Post Code :[1-9]\d{5}(?!\d) ( China Post code is 6 Digit number ) 33 IP Address :\d+\.\d+\.\d+\.\d+ ( extract IP Useful for addresses ) 34 IP Address :((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
边栏推荐
- [in depth study of 4g/5g/6g topics -44]: urllc-15 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -9-low delay technology -3-non slot scheduling mini
- Two methods to judge the size end
- [C language] function
- 5. Difference between break and continue (easy to understand version)
- 私有化部署的即时通讯平台,为企业移动业务安全保驾护航
- Item exception handling in SSM
- [C language] guessing numbers game
- Communication learning static routing across regional networks
- Maximum exchange [greedy thought & monotonic stack implementation]
- Solve flask integration_ Error reporting in restplus
猜你喜欢

Why is customer support important to SaaS?

【实验分享】CCIE—BGP反射器实验

Basic mathematical knowledge (update)

Quick sort template
![[C language] guessing numbers game [function]](/img/db/8ebdb02f137878224367503b730803.png)
[C language] guessing numbers game [function]

Windows系统下Mysql数据库定时备份
![[experiment sharing] CCIE BGP reflector experiment](/img/e4/1ddd611c8438cb6ca1be32f34fa67a.png)
[experiment sharing] CCIE BGP reflector experiment

How to automatically store email attachments in SharePoint

跨区域网络的通信学习静态路由

Storage of C language data in memory (1)
随机推荐
Multi-Modal Knowledge Graph Construction and Application: A Survey
Implementation of memcpy in C language
File lookup and file permissions
New fruit naming (DP is similar to the longest common subsequence)
Power Bi 2021 calendar DAX code
WFST decoding process
LeetCode_位运算_中等_260.只出现一次的数字 III
C language - data storage
Basic mathematical knowledge (update)
Item exception handling in SSM
Raspberry pie 4B ffmpeg RTMP streaming
LeetCode-297-二叉树的序列化与反序列化
[C language] Pointer advanced knowledge points
Basic knowledge of communication network 01
DSACTF7月re
9. Pointer of C language (5) how many bytes does the pointer variable occupy
C language operators and input and output
[C language] summary of methods for solving the greatest common divisor
长轮询,iframe和sse三种web消息实时推送demo实践
Const pointer of C language and parameter passing of main function