I have phone area textbox and i want to test it against values like 1111111 or 9999999.
I want at least 1 character to be different in this text area(it is exactly 7 characters long)
How can i do this in its shortest way?
I have phone area textbox and i want to test it against values like 1111111 or 9999999.
I want at least 1 character to be different in this text area(it is exactly 7 characters long)
How can i do this in its shortest way?
You should still make your checks for length before this but this will check for numbers like 1111111 and 999999
var phone_number = "9999999";
if (!/^(\d)\1{6}$/.test(phone_number)) {
alert('Good phone number');
} else {
alert('Bad phone number');
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.