+ 1
Regex Error
I don't understand why the 4th case is failed l. Anyone can help me to solve this problem and explain Regex problem https://code.sololearn.com/cnLYivd9ZGtL/?ref=app
5 Antworten
+ 3
Think about what it is you are expressing.
Regex("^([a-z]+[A-Z]+[0-9]+){8,20}quot;)
The first part, ([a-z]+[A-Z]+[0-9]+), says, one or more lowercase letters, one or more uppercase letters, one or more numbers. In that order.
Then you add a provision. ^([a-z]+[A-Z]+[0-9]+){8,20}$. That means, the above sequence, repeated between 8 and 20 times. And that from the start to the end of the string.
The problem is, you do have the above sequence, yes, but only once, not at least eight times.
+ 3
There are limits to what you can do with regular expressions. Also, what is still a word in a regular grammar might require an unwieldy expression.
It may be that something is possible with advanced techniques such as look-ahead or something. Unfortunately, this are techniques beyond my expertise. To do complex operations on a string, I would use a cascade of predicate matchings (pipe-and-filter). E.g. simply test the string length with the language tools (pwd.length >= 8), and use regex for complicated evaluations. .
+ 3
My pleasure 🙂
+ 2
Ani Jona 🕊 if I want user password min length is 8 and Max:12 using regular expression . So what to do
+ 2
Ani Jona 🕊 ok Thanks for solving problem