Introduction to Regular Expression Test Tool

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
CodeDescription
.Match any character except for the newline character
\wMatch any letter or number or underscore
\sMatch any whitespace character
\dMatch a digit
\bMatch the beginning or end of a word
^Match the beginning of a string
$Match the end of a string
Common Quantifiers
Code/SyntaxDescription
*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/SyntaxDescription
\WMatch any character that is not a letter, number, underscore, or Chinese character
\SMatch any character that is not a whitespace character
\DMatch any character that is not a digit
\BMatch 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

Regular Expression Reference

CharacterDescription
^\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| ]*\rRegular 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
Your footprint: