1. Overview
1. Regular expression test address: http://tool.chinaz.com/regex/
2. Specific commonly used regular expressions
1. Email regular expression:
1) w[-w.+]*@([A-Za-z0-9][-A-Za-z0-9]+.)+[A -Za-z]{2,14}
2)w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*
3) Analysis:
-- "" is called "escape character". Used to escapesome special symbols, such as ".", "/"
-- "w" is equivalent to [a-zA-Z0-9_]. Also matches Chinese characters
-- "+" 1 or multiple times can also be written as {1,}
- Parentheses are used to specify subexpression (also called grouping), and then you can specify the number of repetitions of this subexpression, ([-+.]w+ )*
--[-+.] The part expanded by square brackets is the character field
- Matches any character except line breaks
4) Code example
<span style="color: #000000;">php </span><span style="color: #800080;">$email</span> = 'sishuinianhua369@126.com'<span style="color: #000000;">; </span><span style="color: #800080;">$preg</span> = '/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/'<span style="color: #000000;">; </span><span style="color: #800080;">$res</span> = <span style="color: #008080;">preg_match</span>(<span style="color: #800080;">$preg</span>, <span style="color: #800080;">$email</span>, <span style="color: #800080;">$preg_res</span><span style="color: #000000;">); </span><span style="color: #008080;">var_dump</span>(111,<span style="color: #800080;">$res</span>,<span style="color: #800080;">$preg_res</span>);<span style="color: #0000ff;">exit</span>;
-- preg_match() : http://php.net/manual/zh/function.preg-match.php
2. URL expression:
1) [a-zA-z]+://[^s]+
2) Analysis:
-- ^
放 & gt; put it before the expression, indicating that the current character starts. (/^n/i, means starting with n). -- s matches any whitespace character
3. Appendix
1. Commonly used metacharactersCode Description. Matches any character except line breaks
w Matches letters or numbers or underscoress Matches any whitespace characterd Matches numbersb Matches the beginning or end of a word
^ Matches the beginning of the string
$ Matches the end of the string
2. Commonly used qualifiers
Code/Syntax Description
* Repeat zero or more times+ Repeat one or more times
? Repeat zero or once{n} Repeat n times{n,} Repeat n times or more
{n,m} Repeat n to m times
3. Commonly used antonyms
Code/Grammar Description
W Matches any character that is not a letter, number, underscore, or Chinese characterS Matches any character that is not a whitespace character
D Matches any non-digit characterB Matches something other than the beginning of a word Or the ending position[^x] Matches any character except x
[^aeiou] Matches any character except the letters aeiou

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
