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

Video Face Swap

Video Face Swap

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

Hot Tools

Safe Exam Browser

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.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

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

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.