Created
January 27, 2016 05:06
-
-
Save edinsoncs/3799ac3311189728e6b2 to your computer and use it in GitHub Desktop.
match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toMatch(string) { | |
var eString = string; | |
var toExpression = /[A-Z]/gi; | |
var result; | |
var match = eString.match(toExpression); | |
var i = 0; | |
while(i < match.length) { | |
console.log(i); | |
i++; | |
if(match.length <= 28) { | |
var t = match.search('a'); | |
result = t; | |
console.log(result) | |
} | |
else { | |
console.log('a'); | |
} | |
} | |
return match | |
} | |
toMatch('hola mi nombre es edinson carranza'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment