0
([a-zA-Z0-3])\1{2,}

i found that this regex is allowing 3 continuous characters and i want to revert the result. so i tries this

(?!([a-zA-Z0-3])\1{2,})    {not giving correct result}
?!([a-zA-Z0-3])\1{2,}      {giving invalid regex error}

what's the correct solution

Christian St.
  • 1,751
  • 2
  • 22
  • 41
Oscar Orcas
  • 117
  • 2
  • 4
  • 17
  • possible duplicate of [How to negate specific word in regex?](http://stackoverflow.com/questions/1240275/how-to-negate-specific-word-in-regex) – Andy Turner Mar 16 '15 at 12:05
  • I can't figure out what you are asking. What do you mean by "2 continuous characters"? What do you mean by "revert the result"? (Reverse? Invert? Something else?) Perhaps you could explain (in English) precisely what you want to happen ... with enough examples to allow us to understand. – Stephen C Mar 16 '15 at 12:15
  • for example i want a pattern that should not allow 000 or 555 or aaa or xxx so i tried this one :- ([a-zA-Z0-3])\1{2,} but this is allowing only 000/555/aaa/xxx that's why i have to invert the result – Oscar Orcas Mar 17 '15 at 04:34

1 Answers1

0

Here below matches only if there are no three consecutive characters.

(?:([a-zA-Z0-3])(\1?)(?!\1))+

Onur Aktaş
  • 410
  • 4
  • 8