The regular expression test tool provides you with JS regular expression verification, regular expression validation, regular expression check, regular expression test tool, which can be used to extract text content with custom regular expressions online, verify any regular expression, extract website URLs with regular expressions, and format regular expressions online, etc., I hope it will be helpful to everyone.
The role of regular expressions
Regular expressions (Regular Expression) are a text pattern that includes ordinary characters (such as letters from a to z) and special characters (referred to as "metacharacters"). Regular expressions use a single string to describe and match a series of strings that match a certain syntax rule. Regular expressions are tedious, but they are powerful, and after learning, the application will not only improve efficiency but also bring you a sense of achievement. Many programming languages support string operations using regular expressions.
Common Metacharacters
Code | Description |
---|---|
. | Match any character except for the newline character |
\w | Match any letter or number or underscore |
\s | Match any whitespace character |
\d | Match a digit |
\b | Match the beginning or end of a word |
^ | Match the beginning of a string |
$ | Match the end of a string |
Common Quantifiers
Code/Syntax | Description |
---|---|
* | Match zero or more occurrences |
+ | Match one or more occurrences |
? | Match zero or one occurrence |
{n} | Match exactly n occurrences |
{n,} | Match at least n occurrences |
{n,m} | Match between n and m occurrences |
Common Negations
Code/Syntax | Description |
---|---|
\W | Match any character that is not a letter, number, underscore, or Chinese character |
\S | Match any character that is not a whitespace character |
\D | Match any character that is not a digit |
\B | Match a position that is not the beginning or end of a word |
[^x] | Match any character except x |
[^aeiou] | Match any character except the letters aeiou |
Character | Description |
---|---|
^\d+$ | //Matches non-negative integers (positive integers + ) |
//Matches integer ^\d+(\.\d+)?$ | //Matches non-negative floating-point numbers (positive floating-point numbers + ) |
^(([-9]+\.[-9]*[1-9][-9]*)|([-9]*[1-9][-9]*\.[-9]+)|([-9]*[1-9][-9]*))$ | //Matches positive floating-point numbers |
^((-\d+(\.\d+)?)|(+(\.+)?))$ | //Matches non-positive floating-point numbers (negative floating-point numbers + ) |
^(-(([-9]+\.[-9]*[1-9][-9]*)|([-9]*[1-9][-9]*\.[-9]+)|([-9]*[1-9][-9]*)))$ | //Matches negative floating-point numbers |
^(-?\d+)(\.\d+)?$ | //Matches floating-point numbers |
^[A-Za-z]+$????????? | //Matches strings composed of 26 English letters |
^[A-Z]+$ ??? | //Matches strings composed of 26 uppercase English letters |
^[a-z]+$ | //Matches strings composed of 26 lowercase English letters |
^[A-Za-z-9]+$ | //Matches strings composed of numbers and 26 English letters |
^\w+$ | //Matches strings composed of numbers, 26 English letters, or underscores |
^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$ | //Matches email addresses |
^[a-zA-z]+://匹配(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ | //Matches URLs |
[\u4e00-\u9fa5] | Regular expression for matching Chinese characters |
[^\x00-\xff] | Matches multibyte characters (including Chinese characters) |
\n[\s| ]*\r | Regular expression for matching empty lines |
/<(.*)>.*<\/>|<(.*)\/>/ | Regular expression for matching HTML tags |
(^\s*)|(\s*$) | Regular expression for matching leading and trailing spaces |
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* | Regular expression for matching Email addresses |
^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ | Regular expression for matching website URLs |
^[a-zA-Z][a-zA-Z-9_]{4,15}$ | Matches whether the account is legal (starts with a letter, allows 5-16 bytes, allows letters, numbers, and underscores) |
(\d{3}-|\d{4}-)?(\d{8}|\d{7})? | Matches domestic phone numbers |
^[1-9]*[1-9][-9]*$ | Matches Tencent QQ numbers |
Friendship link: Online Tool Network masters tool Calculation Assistant mathematical calculator ipsaya Random IP Strong Random Password Generator 2 to the power of what is 1/64 Globe Ask hello wordl Live Clock Numbers to Letters Pokemon Guide Snail Bob Red Light Green Light Game Excel Game Block Blast Unblocked Incredibox Sprunki Today Lucky Number Military Time Chart Chronological Age Calculator 12 Weeks From Today Weeks From Today Bottleneck Calculator Letters to Numbers