Our Regular Expression Tester Tool provides a convenient solution for testing and validating regular expressions. Whether you need to validate input using JavaScript regular expressions or test custom regex patterns, this tool simplifies the process and helps you ensure accurate regex matching.
Using our online Regular Expression Tester tool is straightforward:
Key features of our Regular Expression Tester Tool include:
Whether you're validating input strings, testing custom regex patterns, or extracting specific content, our Regular Expression Tester Tool simplifies the process and ensures accurate regex matching for your needs.
The function of regular expressions
Regular Expression (Regular Expression) is a text pattern, including ordinary characters (for example, letters between a to z) and special characters (called "metacharacters"). Regular expressions use a single string to describe and match a series of strings that match a certain syntactic rule. Regular expressions are cumbersome, but they are powerful. Learning how to use them will not only improve your efficiency but also give you a sense of accomplishment. Many programming languages support using regular expressions for string operations.
Common metacharacters
Code | Description |
---|---|
. | Matches any character except a newline character |
\w | Matches any letter, digit, or underscore |
\s | Matches any whitespace character |
\d | Matches a digit |
\b | Matches the start or end of a word |
^ | Matches the start of a string |
$ | Matches the end of a string |
Common Quantifiers
Code/Syntax | Description |
---|---|
* | Matches zero or more times |
+ | Matches one or more times |
? | Matches zero or one time |
{n} | Matches exactly n times |
{n,} | Matches at least n times |
{n,m} | Matches between n and m times |
Common Negations
Code/Syntax | Description |
---|---|
\W | Matches any character that is not a letter, digit, underscore, or Chinese character |
\S | Matches any character that is not a whitespace character |
\D | Matches any character that is not a digit |
\B | Matches a position that is not a word boundary |
[^x] | Matches any character except x |
[^aeiou] | Matches any character except the letters a, e, i, o, u |
Character | Description |
---|---|
^\d+$ | // Matches non-negative integers (positive integers + 0) |
// Matches integers ^\d+(\.\d+)?$ | // Matches 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]*))$ | // Matches positive floating point numbers |
^((-\d+(\.\d+)?)|(0+(\.0+)?))$ | // Matches 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]*)))$ | // Matches negative floating point numbers |
^(-?\d+)(\.\d+)?$ | // Matches floating point numbers |
^[A-Za-z]+$????????? | // Matches strings consisting of 26 English letters |
^[A-Z]+$ ??? | // Matches strings consisting of 26 uppercase English letters |
^[a-z]+$ | // Matches strings consisting of 26 lowercase English letters |
^[A-Za-z0-9]+$ | // Matches strings consisting of numbers and 26 English letters |
^\w+$ | // Matches strings consisting 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] | // Matches Chinese characters |
[^\x00-\xff] | // Matches double-byte characters (including Chinese characters) |
\n[\s| ]*\r | // Matches empty lines |
/<(.*)>.*<\/>|<(.*)\/>/ | // Matches HTML tags |
(^\s*)|(\s*$) | // Matches leading and trailing spaces |
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* | // Matches Email addresses |
^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ | // Matches URLs |
^[a-zA-Z][a-zA-Z0-9_]{4,15}$ | // Matches account validity (starts with a letter, allows 5-16 bytes, allows letters, numbers, underscores) |
(\d{3}-|\d{4}-)?(\d{8}|\d{7})? | // Matches domestic phone numbers |
^[1-9]*[1-9][0-9]*$ | // Matches Tencent QQ numbers |
Links: google