Regex Help! (unique numbers)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • S1Seq
    New Member
    • May 2014
    • 1

    Regex Help! (unique numbers)

    Hey would anyone be able to help me create a regex for Python that has a minimum of 3 characters and a max of 5 characters? the first 3 characters have to be unique and the last two optional characters can be any characters.

    Once again, the last two characters can be anything! (even the same as one of the first 3 characters)

    This is what I have right now: ^(?:(\w)(?!.*\1 )){3}\w{0,2}$

    The only problem with this regex is that it does not allow the last two characters to be the same as any of the first 3. (eg. pfaab doesnt work when it should)

    Can anyone help please?
Working...