Nikolay I. Yordanov
Nikolay I. Yordanov

Reputation: 1

Lenght of a capture group in regex

I am trying to write a program which matches a password requirement. The criteria is something like this:

##>digits|letters(need to be as much as the digits)|symbols(also need to be as much as the digits)<##

Here is an example:

##>00|no|NO|!!!?<### - no match
##>123|yes|YES|!!!<## - match
$$<111|noo|NOPE|<<>$$ - no match

Can someone help me please.

Upvotes: 0

Views: 41

Answers (1)

Themelis
Themelis

Reputation: 4245

It's not that difficult if you know the count of the digits.

If that count is 5 for example then I believe this will do [0-9]{5}\|[a-zA-Z]{5}\|[^a-zA-Z0-9]{5}.

Upvotes: 1

Related Questions