Introduction to Regular Expression Testing Tools

Regular Expression Testing Tool provides JavaScript regular expression validation, regular expression verification, regular expression validation, and regular expression testing tools. It enables online customization of regular expressions to extract text content, validates any regular expression, extracts URLs from regular expressions, and offers online regular expression formatting. We hope this proves helpful to everyone.


The purpose of regular expressions

Regular expressions are text patterns composed of ordinary characters (such as letters from a to z) and special characters (known as “metacharacters”). Regular expressions use a single string to describe and match a series of strings conforming to a specific syntax rule. While complex, they are immensely powerful. Mastering their application not only boosts efficiency but delivers a profound sense of accomplishment. Numerous programming languages support string manipulation through regular expressions.

Common Metacharacters
CodeNote
.Match any character except a newline character
\wMatch letters or numbers or underscores
\sMatch any whitespace character
\dMatching Numbers
\bMatching the beginning or end of a word
^Matching the beginning of a string
$EMatching the end of a string
Common Qualifiers
Code/SyntaxNote
*Repeat zero or more times
+Repeat once or more times
?Repeat zero or one time
{n}Repeat n times
{n,}Repeat n times or more
{n,m}Repeat n to m times
Common Antonyms
Code/SyntaxNote
\WMatch any character that is not an alphabet, digit, underscore, or Chinese character.
\SMatch any character that is not a whitespace character
\DMatch any non-numeric character
\BThe match does not occur at the beginning or end of a word.
[^x]Match any character except x
[^aeiou]Match any character except the letters a, e, i, o, and u.

Regular Expression Reference Guide

CharacterDescription
^\d+$// Match non-negative integers (positive integers + 0)
Match an integer: ^\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 strings composed of the 26 letters of the English alphabet
^[A-Z]+$ ???// Match strings composed of uppercase letters from the 26 letters of the English alphabet
^[a-z]+$// Match strings composed of lowercase letters from the 26 letters of the English alphabet
^[A-Za-z0-9]+$// Match strings composed of numbers and the 26 letters of the English alphabet
^\w+$// Matches strings composed of numbers, the 26 English letters, or underscores
^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$//Match email addresses
^[a-zA-z]+://Match(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$//Match url
[\u4e00-\u9fa5]Regular expressions for matching Chinese characters
[^\x00-\xff]Match double-byte characters (including Chinese characters)
\n[\s| ]*\rRegular expression matching empty lines
/<(.*)>.*<\/>|<(.*)\/>/Regular expressions for matching HTML tags
(^\s*)|(\s*$)Regular expression matching leading and trailing whitespace
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*Regular expression for matching email addresses
^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$Regular expression for matching URLs
^[a-zA-Z][a-zA-Z0-9_]{4,15}$Verify account legitimacy (must start with a letter, 5-16 bytes allowed, alphanumeric characters and underscores permitted)
(\d{3}-|\d{4}-)?(\d{8}|\d{7})?Match(86) phone numbers
^[1-9]*[1-9][0-9]*$Match QQ number
Footprints:

Links: Developer Tools