-2

I have a requirement that need to handle the regex expression for below: -must not contain any of Alphabets in sequence more than 3 consecutive letters (PASS - abc, bcd, aabcd, abcdd, abcc, cdee, ghid, stua | FAIL - abcd, bcde, cdef, ghijklm)

Abhi
  • 1

1 Answers1

0

It is a little long but I think this is what you are looking for:

\w*((abcd)|(bcde)|(cdef)|(defg)|(efgh)|(fghi)|(ghij)|(hijk)|(ijkl)|(jklm)|
(klmn)|(lmno)|(mnop)|(nopq)|(opqr)|(pqrs)|(qrst)|(rstu)|(stuv)|(tuvw)|(uvwx)|
(vwxy)|(wxyz))\w*

this pattern matches all failing strings. The idea is simple: if a string has a sequence with 4 letters in a row is invalid.