search
Homephp教程php手册php中正则匹配用户密码

一篇简单的php中正则匹配用户密码实现程序,密码形式可以根据开发需求自己设定,下面是几个匹配密码的,有需要的朋友可参考

例1

 代码如下 复制代码

//密码验证
$password = "zongzi_Abc_oo13a2";
$n = preg_match_all("/^[a-zA-Zd_]{8,}$/",$password,$array);
//长度是8或更多
var_dump($array);
?>

其它规则这里就不举例了大家可直接参阅

 例子:

正则表达式
^[a-zA-Z]w{5,17}$
匹配 以字母开头,长度在6~18之间,只能包含字符、数字和下划线
不匹配  

正则表达式
^(?=.*d)(?=.*[a-z])(?=.*[A-Z])(?!.*s).{4,8}$
匹配 1agdA*$# | 1agdA*$# | 1agdA*$#
不匹配 wyrn%@*&$# f | mbndkfh782 | BNfhjdhfjd&*)%#$)

 
正则表达式
[^A-Za-z0-9]
匹配 !@#$ | %^&* | '>
不匹配 ABC123abc | abc123ABC | abc0132ABC

正则表达式
Password="({.+}[0-9a-zA-Z]+[=]*|[0-9a-zA-Z]+)"
匹配 !@#$ | %^&* | '>
不匹配 ABC123abc | abc123ABC | abc0132ABC

正则表达式
(?-i)(?=^.{8,}$)((?!.*s)(?=.*[A-Z])(?=.*[a-z]))(?=(1)(?=.*d)|.*[^A-Za-z0-9])^.*$
匹配 a3dAbed. | P@ssword1 | aB_1bbbb | myPassw0rd!
不匹配 password | password12 | password__12 | p@ssw0rd



本文地址:

转载随意,但请附上文章地址:-)

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

DVWA

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

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)