Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the common regular expressions of ASP.NET

Shulou Source: shulou.com Published: 2022-06-02 03:46:12 10月02日 Update

Editor to share with you what ASP.NET regular expressions are commonly used, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Integer or decimal: ^ [0-9] +\. {0jue 1} [0-9] {0jue 2} $

Only the number "^ [0-9] * $" can be entered.

Only n-digit numbers can be entered: "^\ d {n} $".

You can only enter at least n digits: "^\ d {n,} $".

You can only enter the number of mdistinct n digits:. "^\ d {mrecoery n} $"

You can only enter zero and non-zero numbers: "^ (0 | [1-9] [0-9] *) $".

Only positive real numbers with two decimal places can be entered: "^ [0-9] + (. [0-9] {2})? $".

Only positive real numbers with 1-3 decimal places can be entered: "^ [0-9] + (. [0-9] {1pr 3})? $".

You can only enter a positive integer that is not zero: "^\ +? [1-9] [0-9] * $".

You can only enter a negative integer that is not zero: "^\-[1-9] [] 0-9" * $.

Only characters of length 3 can be entered: "^. {3} $".

You can only enter a string of 26 letters: "^ [A-Za-z] + $".

You can only enter a string of 26 capital letters: "^ [Amurz] + $".

You can only enter a string of 26 lowercase letters: "^ [amurz] + $".

You can only enter a string of numbers and 26 letters: "^ [A-Za-z0-9] + $".

You can only enter a string consisting of numbers, 26 letters, or an underscore: "^\ wicked $".

Verify the user password: "^ [a-zA-Z]\ w {5pm 17} $" is in the correct format: begins with a letter, is between 6x18 in length, and can only contain characters, numbers and underscores.

Verify that it contains characters such as ^% &',; =? $\ ":" [^% &',; =? $\ x22] + ".

You can only enter Chinese characters: "^ [\ u4e00 -\ u9fa5] {0,} $"

Verify the Email address: "^\ w + ([- +.]\ w +) * @\ w + ([-.]\ w +) *.\ w + ([-.]\ w +) * $".

Verify InternetURL: "^ http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$".

Verify the phone number: "^ (\ (\ d {3pr 4} -) |\ d {3.4} -)?\ d {7 XXXX- XXXXXXXX 8} $" the correct format is: "XXX-XXXXXXX", "XXXX- XXXXXXXX", "XXX-XXXXXXX", "XXX-XXXXXXXX", "XXXXXXX" and "XXXXXXXX".

Verify the ID number (15 or 18 digits): "^\ d {15} |\ d {18} $".

Verify the 12 months of the year: "^ (0? [1-9] | 1 [0-2]) $" the correct format is: "01" ~ "09" and "1" ~ "12".

Verify the 31 days of the month: "^ ((0? [1-9]) | (1 | 2) [0-9]) | 30 | 31) $" the correct format is; "01" ~ "09" and "1" ~ "31". Integer or decimal: ^ [0-9] +\. {0jue 1} [0-9] {0jue 2} $

Only the number "^ [0-9] * $" can be entered.

Only n-digit numbers can be entered: "^\ d {n} $".

You can only enter at least n digits: "^\ d {n,} $".

You can only enter the number of mdistinct n digits:. "^\ d {mrecoery n} $"

You can only enter zero and non-zero numbers: "^ (0 | [1-9] [0-9] *) $".

Only positive real numbers with two decimal places can be entered: "^ [0-9] + (. [0-9] {2})? $".

Only positive real numbers with 1-3 decimal places can be entered: "^ [0-9] + (. [0-9] {1pr 3})? $".

You can only enter a positive integer that is not zero: "^\ +? [1-9] [0-9] * $".

You can only enter a negative integer that is not zero: "^\-[1-9] [] 0-9" * $.

Only characters of length 3 can be entered: "^. {3} $".

You can only enter a string of 26 letters: "^ [A-Za-z] + $".

You can only enter a string of 26 capital letters: "^ [Amurz] + $".

You can only enter a string of 26 lowercase letters: "^ [amurz] + $".

You can only enter a string of numbers and 26 letters: "^ [A-Za-z0-9] + $".

You can only enter a string consisting of numbers, 26 letters, or an underscore: "^\ wicked $".

Verify the user password: "^ [a-zA-Z]\ w {5pm 17} $" is in the correct format: begins with a letter, is between 6x18 in length, and can only contain characters, numbers and underscores.

Verify that it contains characters such as ^% &',; =? $\ ":" [^% &',; =? $\ x22] + ".

You can only enter Chinese characters: "^ [\ u4e00 -\ u9fa5] {0,} $"

Verify the Email address: "^\ w + ([- +.]\ w +) * @\ w + ([-.]\ w +) *.\ w + ([-.]\ w +) * $".

Verify InternetURL: "^ http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$".

Verify the phone number: "^ (\ (\ d {3pr 4} -) |\ d {3.4} -)?\ d {7 XXXX- XXXXXXXX 8} $" the correct format is: "XXX-XXXXXXX", "XXXX- XXXXXXXX", "XXX-XXXXXXX", "XXX-XXXXXXXX", "XXXXXXX" and "XXXXXXXX".

Verify the ID number (15 or 18 digits): "^\ d {15} |\ d {18} $".

Verify the 12 months of the year: "^ (0? [1-9] | 1 [0-2]) $" the correct format is: "01" ~ "09" and "1" ~ "12".

Verify the 31 days of the month: "^ ((0? [1-9]) | (1 | 2) [0-9]) | 30 | 31) $" the correct format is; "01" ~ "09" and "1" ~ "31".

The above is all the content of the article "what are the common regular expressions of ASP.NET?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Input number character validation letter string English format decimal integer underscore real number beginning length article commonly used regular expression between content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Microsoft Redmi MySQL