简体   繁体   English

是什么意思?=在^之后?

[英]What's the meaning of ?= right after ^?

Following is one of strong password validation that at least six characters and contains a digit, symbol, or punctuation mark. 以下是强密码验证之一,至少包含六个字符并包含数字,符号或标点符号。

(?x)^(?=.* ( \d | \p{P} | \p{S} )).{6,}

What's the meaning of (?=.* after (?x)^ ? 是什么意思(?=.* after (?x)^

I understand ?= expr is Lookahead that checks whether the text that follows matches expr. 我理解?= expr是Lookahead,用于检查后面的文本是否与expr匹配。 But in this case, only ^ that is start of a string is ahead. 但在这种情况下,只有字符串开头的^才能领先。

In words: 用语言:

The comments flag is set ( (?x) ). 注释标志已设置( (?x) )。

The start of the string ( ^ ) must be first, which must be followed by ( ?= ) zero or more characters ( .* ), then either ( (||) ) a digit ( \\d ), a punctuation mark ( \\p{P} ) or a symbol ( \\p{S} ). 字符串( ^ )的开头必须是第一个,必须后跟( ?= )零个或多个字符( .* ),然后是( (||) )一个数字( \\d ),一个标点符号( \\p{P} )或符号( \\p{S} )。

After the start of string, there must be 6 or more of any characters ( .{6,} ) 字符串开始后,必须有6个或更多字符( .{6,}

Does that explain it? 这解释了吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM