Created
April 28, 2013 20:14
-
-
Save DC3/5478249 to your computer and use it in GitHub Desktop.
This file contains 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
'wkjkjd fsk fsdjk\nbbb sss fasdf'.replace(/(bbb|sss)(\s)?/g, function(match, p1, p2){ | |
var min = 1, max = p1.length - 1, | |
pos = Math.floor(Math.random() * (max - min + 1)) + min; //randint | |
return p1.substr(0, pos) + 'a' + p1.substr(pos, p1.length - 1) + p2; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment