The regular expression testing tool provides you with js regular expression verification, regular expression verification, regular expression verification, regular expression testing tool. You can customize regular expressions to extract text content online, check any regular expression, regular expression extraction URL, regular expression online formatting, etc. I hope it will be helpful to everyone.
The role of regular expressions
Regular expressions are text patterns that include normal characters (for example, letters between a to z) and special characters (called "metachars"). 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. The application after learning will give you an absolute sense of accomplishment in addition to improving efficiency. Many programming languages support the use of regular expressions for string operations.
Common metacharacters
Code | illustrate |
---|---|
. | Match any character other than line break |
\w | Match letters or numbers or underscores |
\s | Match any blank characters |
\d | Match numbers |
\b | Match the beginning or end of a word |
^ | Match the beginning of a string |
$ | Match the end of the string |
Commonly used qualifiers
Code/Syntax | illustrate |
---|---|
* | Repeat zero or more times |
+ | Repeat once or more times |
? | Repeat zero or once |
{n} | Repeat n times |
{n,} | Repeat n or more times |
{n,m} | Repeat n to m times |
Common antonyms
Code/Syntax | illustrate |
---|---|
\W | Match any characters that are not letters, numbers, underscores, or Chinese characters |
\S | Match any characters that are not whitespace characters |
\D | Match any non-numeric characters |
\B | Match is not the beginning or end of a word |
[^x] | Match any character other than x |
[^aeiou] | Match any character except the letters aeiou |
character | describe |
---|---|
^\d+$ | //Match non-negative integers (positive integer + 0) |
//Match 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 number |
^((-\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 composed of 26 English letters |
^[A-Z]+$ ??? | //Match strings composed of 26 English letters capitalization |
^[a-z]+$ | //Match a string composed of 26 English letters lowercase |
^[A-Za-z0-9]+$ | //Match a string composed of numbers and 26 English letters |
^\w+$ | //Match strings composed 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 matching Chinese characters |
[^\x00-\xff] | Match double-byte characters (including Chinese characters) |
\n[\s| ]*\r | Regular expression matching empty lines |
/<(.*)>.*<\/>|<(.*)\/>/ | Regular expressions matching HTML tags |
(^\s*)|(\s*$) | Regular expression matching the beginning and end 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}$ | Match whether the account is legal (beginning with letters, 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 number |
Link:aitoolsbar