Q:

Regular Expression in JS for numbers

I'm looking for a regular expression in javascript that takes care of this:
Accept only numbers between 6 and 15 digits, 6 is the minimum.
Numbers cannot contain groups of repeated digits, such as 408408 or 123123
Numbers cannot contain only two different digits, such as 121212
I started with this, then I was loss
^[0-9]{6,15}$ 

A:

You have the first rule correct:
^\d{6,15}$

That covers both the 6-15 length requirement and the fact that it has to be numeric.
With the next rule, it's easier to test for repeated substrings than to test for their absence:
(.+)\1

The last one is a lot more complicated. Here's how you test for at least 3 distinct characters:
(.+)(?!\1)(.+)(?!\1|\2).

Put it all together and what do you get:
^(?=\d{6,15}$)(?!.*(.+)\1)(.+)(?!\2)(.+)(?!\2|\3).+$

That answers your question as written, but as I said in the comments, you should consider very carefully whether you're starting from the right assumptions. You don't have to use regex for this, nor do you have to do it all in one regex. Will the pattern above be easy for you to work with when you come back in 6 months and have to change the rules? 
More importantly, if you're trying to make sure users pick a strong password, the rules you're using will weaken your security by reducing the number of possible choices. And the maximum length of 15 characters suggests you're storing passwords in plain text. You should be hashing them. 

