[a-zA-Z0-9\@\#\$\%\&\*\(\)\-\_\+\]\[\'\;\:\?\.\,\!\^]+$
有効な出力は次のとおりです。 reahb543)(*&&!@#$%^kshABmhbahdxb!@$@#%6813741646
これは私が持っている表現です。しかし、値は8 ~ 32 桁にする必要があります。
したがって、有効な文字列は次のようになります。
- 8 ~ 32 文字
- 数字、アルファベット、特殊文字を含む
[a-zA-Z0-9\@\#\$\%\&\*\(\)\-\_\+\]\[\'\;\:\?\.\,\!\^]+$
有効な出力は次のとおりです。 reahb543)(*&&!@#$%^kshABmhbahdxb!@$@#%6813741646
これは私が持っている表現です。しかし、値は8 ~ 32 桁にする必要があります。
したがって、有効な文字列は次のようになります。
あなたの表現で私が変更したいことがいくつかあります:
この式は次のようになります。
^(?=(?:\D*?\d){8,32}(?!.*?\d))[a-zA-Z0-9@\#$%&*()_+\]\[';:?.,!^-]+$
NODE EXPLANATION
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
(?= look ahead to see if there is:
--------------------------------------------------------------------------------
(?: group, but do not capture (between 8 and
32 times (matching the most amount
possible)):
--------------------------------------------------------------------------------
\D*? non-digits (all but 0-9) (0 or more
times (matching the least amount
possible))
--------------------------------------------------------------------------------
\d digits (0-9)
--------------------------------------------------------------------------------
){8,32} end of grouping
--------------------------------------------------------------------------------
(?! look ahead to see if there is not:
--------------------------------------------------------------------------------
.*? any character except \n (0 or more
times (matching the least amount
possible))
--------------------------------------------------------------------------------
\d digits (0-9)
--------------------------------------------------------------------------------
) end of look-ahead
--------------------------------------------------------------------------------
) end of look-ahead
--------------------------------------------------------------------------------
[a-zA-Z0- any character of: 'a' to 'z', 'A' to 'Z',
9@\#$%&*()_+\]\[';:? '0' to '9', '@', '\#', '$', '%', '&', '*',
.,!^-]+ '(', ')', '_', '+', '\]', '\[', ''', ';',
':', '?', '.', ',', '!', '^', '-' (1 or
more times (matching the most amount
possible))
--------------------------------------------------------------------------------
$ before an optional \n, and the end of the
string
サンプル
reahb)(*&&!@#$%^kshABmhbahdxb!@$@#%1234567 = bad
reahb)(*&&!@#$%^kshABmhbahdxb!@$@#%12345678 = good
1234reahb)(*&&!@#$%^kshABmhbahdxb!@$@#%5678 = good
1234reahb)(*&&!@#$%^kshABmhbahdxb!@$@#%5678901234567890123456789012 = good
1234reahb)(*&&!@#$%^kshABmhbahdxb!@$@#%56789012345678901234567890123 = bad
reahb)(*&&!@12345678901234567890123456789012#$%^kshABmhbahdxb!@$@#% = good
reahb)(*&&!@123456789012345678901234567890123#$%^kshABmhbahdxb!@$@#% = bad
文字クラスから任意のタイプの 8 ~ 32 文字のみを許可する場合は、次のように動作します。
^[a-zA-Z0-9@\#$%&*()_+\]\[';:?.,!^-]{8,32}$