Introduction to Regular Expression Test Tool
Regular expression test tool for you to provide js regular expression validation, regular expression validation, regular expression verification, regular expression test tool, can be customised online regular expression to extract the text content, any regular expression to check, regular expression to extract the URL, regular expression online formatting and so on, I hope to help you.
The role of regular expressions
Regular Expression (Regular Expression) is a text pattern, including ordinary characters (for example, a to z between the letters) and special characters (known as "metacharacters"). Regular expressions use a single string to describe, and match, a series of strings that match a syntax rule. Regular expressions are tedious, but they are powerful, and learning to use them will give you an absolute sense of achievement in addition to efficiency, and many programming languages support string manipulation using regular expressions.
Commonly used metacharacters
Code | Description |
---|
. | Match any character except line breaks |
\w | Match letters or numbers or underscores |
\s | Matches any white space character |
\d | Matches a number |
\b | Matches the beginning or end of a word |
^ | Match the beginning of a string |
$ | Matches the end of a string |
Common Qualifiers
Code/Syntax | Description |
---|
* | Repeat zero or more times |
+ | Repeat once or more |
? | Repeat zero or one time |
{n} | Repeat n times |
{n,} | Repeat n or more times |
{n,m} | Repeat n to m times |
Common Antonyms
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 blank character |
\D | Match any character that is not a number |
\B | Match any character that is not the beginning or end of a word. |
[^x] | Match any character except x |
[^aeiou] | Matches any character except aeiou. |
Regular expression reference book
Characters | Description |
---|
^\d+$ | //Match non-negative integer (positive integer + 0) |
//Match integer ^\d+(\. \d+)? \d+(\...\d+)? | //Match non-negative floating point numbers (positive floats + 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-negative floats (negative floats + 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 float |
^(-?\d+)(\.\d+)?$ | //Match floating point numbers |
^[A-Za-z]+$????????? | //Match a string of 26 letters of the alphabet |
^[A-Z]+$ ??? | //matches a string of 26 uppercase letters of the alphabet |
^[a-z]+$ | //matches a string of 26 letters in lower case |
^[A-Za-z0-9]+$ | //matches strings consisting of numbers and 26 letters of the alphabet |
^\w+$ | //Match strings consisting of numbers, 26 letters or underscores. |
^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$ | //Match email address |
^[a-zA-z]+://matches (\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 blank lines |
/<(.*)>.*<\/>|<(.*)\/>/ | Regular expression to match HTML tags |
(^\s*)|(\s*$) | Regular expression to match first and last spaces |
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* | Regular expression to match Email address |
^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ | Regular expression to match URLs |
^[a-zA-Z][a-zA-Z0-9_]{4,15}$ | Match the account number is legal (start with a letter, allow 5-16 bytes, allow alphanumeric underscore) |
(\d{3}-|\d{4}-)?(\d{8}|\d{7})? | Match Domestic Phone Number |
^[1-9]*[1-9][0-9]*$ | Match Tencent QQ number |