I am trying to figure it out how can I check if a string has three ascending letters and/or number in a string. For example, if a string has "manabcrt" then there is "abc" or "castle567", there is "567" in the string or "castlexyzand789" it has "xyz" and 789 ... so I want to check for that. I find this one fiddle but it is doing for the repeating letters.
This is the code from the fiddle:
var inputs = [
'helloworld',
'hellloworld',
'aaabc',
'abcddd',
'bbabba'];
var violators = [];
inputs.forEach(function(input) {
if (/(.)\1\1/.test(input)) {
violators.push(input);
}});
alert("VIOLATORS:\n" + violators.join('\n'));