The regular expression testing tool provides you with js regular expression verification, regular expression verification, regular expression verification, regular expression testing tools, and online custom regular expressions to extract text content. Regular expression verification, regular expression extraction URL, regular expression online formatting, etc., I hope to help everyone.
The role of regular expressions
A Regular Expression is a text pattern that includes normal characters (eg, letters between a and z) and special characters (called "metacharacters"). Regular expressions use a single string to describe and match a series of strings that match a syntactic rule. Regular expressions are cumbersome, but they are powerful. In addition to improving efficiency, the application after learning will bring you an absolute sense of accomplishment. Many programming languages support the use of regular expressions for string operations.
Common metacharacters
code | explain |
---|---|
. | Matches any character except newlines |
\w | Matches letters or numbers or underscores |
\s | match any whitespace |
\d | match numbers |
\b | match the beginning or end of the word |
^ | match the beginning of the string |
$ | match the end of the string |
Common qualifiers
code/syntax | explain |
---|---|
* | Repeat zero or more times |
+ | Repeat one 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 |
Commonly used antonyms
code/syntax | explain |
---|---|
\W | Match any characters that are not letters, numbers, underscores, Chinese characters |
\S | match any character that is not a whitespace |
\D | match any non-digital character |
\B | match is not the beginning or end of the word |
[^x] | match any character except x |
[^aeiou] | Matches any character except aeiou |
character | description |
---|---|
^\d+$ | //Matches non-negative integers (positive integers + 0) |
//match integer ^\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]*))$ | //match 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+)?$ | //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*)?$ | //matchurl |
[\u4e00-\u9fa5] | regular expression matching Chinese characters |
[^\x00-\xff] | match double-byte characters (including Chinese characters) |
\n[\s| ]*\r | regular expression matching blank lines |
/<(.*)>.*<\/>|<(.*)\/>/ | regular expression matching HTML tags |
(^\s*)|(\s*$) | regular expression that matches leading and trailing spaces |
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* | regular expression matching email address |
^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$ | Regular expression matching URL |
^[a-zA-Z][a-zA-Z0-9_]{4,15}$ | Whether the matching account number is legal (beginning with letters, allowing 5-16 bytes, allowing alphanumeric underscores) |
(\d{3}-|\d{4}-)?(\d{8}|\d{7})? | Matches domestic phone numbers |
^[1-9]*[1-9][0-9]*$ | match Tencent QQ number |
Friend Link: 沐杉软件