Tutorial by Examples

As the characters/digits can be anywhere within the string, we require lookaheads. Lookaheads are of zero width meaning they do not consume any string. In simple words the position of checking resets to the original position after each condition of lookahead is met. Assumption :- Considering non-wo...
This can be done with a bit of modification in the above regex ^(?=.{10,}$)(?=(?:.*?[A-Z]){2})(?=.*?[a-z])(?=(?:.*?[0-9]){2}).*$ or ^(?=.{10,}$)(?=(?:.*[A-Z]){2})(?=.*[a-z])(?=(?:.*[0-9]){2}).* Let's see how a simple regex ^(?=(?:.*?[A-Z]){2}) works on string abcAdefD Image Credit :- ht...

Page 1 of 1