Introduction to regular expression testing tools

Regular expression testing tools provide you with js regular expression verification, regular expression verification, regular expression verification, and regular expression testing tools. You can customize regular expressions online to extract text content and verify any regular expressions. , regular expression extraction URL, regular expression online formatting, etc. I hope it will be helpful to everyone.


The role of regular expressions

正则表达式(Regular Expression)是一种文本模式,包括普通character(例如,a 到 z 之间的字母)和特殊字符(称为"元字符")。正则表达式使用单个字符串来describe、匹配一系列匹配某个句法规则的字符串。正则表达式是繁琐的,但它是强大的,学会之后的应用会让你除了提高效率外,会给你带来绝对的成就感,许多程序设计语言都支持利用正则表达式进行字符串操作。

Commonly used metacharacters
code illustrate
. Matches any character except newlines
\w Match letters or numbers or underscores
\s Matches any whitespace character
\d Match numbers
\b Match the beginning or end of a word
^ Matches the beginning of a string
$ Match the end of the string
Common qualifiers
code/syntax illustrate
* Repeat zero or more times
+ Repeat one or more times
? Repeat zero or once
{n} Repeat n times
{n,} Repeat n or more times
{n,m} Repeat n to m times
Commonly used antonyms
code/syntax illustrate
\W Matches any character that is not letters, numbers, underscores, or Chinese characters
\S Matches any character that is not whitespace
\D Matches any non-digit character
\B Matches something other than the beginning or end of a word
[^x] Matches any character except x
[^aeiou] Matches any character except aeiou.

Regular expression reference

字符 描述
^\d+$ //Match non-negative integers (positive integers + 0)
//Match integers ^\d+(\.\d+)?$ //Match non-negative floating point numbers (positive floating point numbers + 0)
^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$ //Match positive floating point numbers
^((-\d+(\.\d+)?)|(0+(\.0+)?))$ //Match non-positive floating point numbers (negative floating point numbers + 0)
^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$ //Match negative floating point numbers
^(-?\d+)(\.\d+)?$ //Match floating point numbers
^[A-Za-z]+$????????? //Match a string consisting of 26 English letters
^[A-Z]+$ ??? //Match a string consisting of 26 uppercase English letters
^[a-z]+$ //Match a string consisting of 26 lowercase English letters
^[A-Za-z0-9]+$ //Match a string consisting of numbers and 26 English letters
^\w+$ //Match a string consisting of numbers, 26 English letters, or underscores
^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$ //Match email address
^[a-zA-z]+://match(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ //match url
[\u4e00-\u9fa5] Regular expression to match Chinese characters
[^\x00-\xff] Match double-byte characters (including Chinese characters)
\n[\s| ]*\r Regular expression to match empty lines
/<(.*)>.*<\/>|<(.*)\/>/ Regular expression to match HTML tags
(^\s*)|(\s*$) Regular expression matching leading and trailing spaces
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* Regular expression to match email addresses
^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ Regular expression to match URL
^[a-zA-Z][a-zA-Z0-9_]{4,15}$ Whether the matching account is legal (starting with a letter, 5-16 bytes allowed, alphanumeric underscores allowed)
(\d{3}-|\d{4}-)?(\d{8}|\d{7})? Match domestic phone numbers
^[1-9]*[1-9][0-9]*$ Match Tencent QQ account